Hello
Bhavesh,
Thank you for posting in the Wazuh community.
If you remove the
only_logs_after configuration, do you get the logs as expected with logs after the date you've set (2021-APR-14)?
As you can find in
this Wafuh for AWS WAF guide, in step 7 (attached) the destination to send to an S3 Bucket, Select the S3 Buchet created previously and put it in the <name>, and finally add the path you've chosen as prefix then put it between the
<path></path> tags.
<wodle name="aws-s3">
<disabled>no</disabled>
<interval>120m</interval>
<run_on_start>yes</run_on_start>
<skip_on_error>yes</skip_on_error>
<bucket type="waf">
<name>waf-logs-bucket</name> <!-- PUT HERE THE S3 BUCKET CHOSEN IN STEP 7 -->
<path></path> <!-- PUT HERE THE PREFIX CHOSEN IN STEP 7 -->
<only_logs_after>2021-APR-14</only_logs_after>
<aws_profile>my-prod-profile</aws_profile>
</bucket>
</wodle>
If you are getting logs as expected, but you want to avoid downloading the old logs from the bucket, you can consider
this AWS link to manage the s3 bucket lifecycle to change the logs retention policy.
The wazuh app will take all those logs and merge the logs that don't exist in the ElasticSearch.
In the following blog, you have a complete example to configure Wazuh to ingest logs from AWS CloudTrail S3 Bucket:
Additionally, to get the debug information in the /var/ossec/etc/local_internal_options.conf file, you have to add this to get the detailed level, after troubleshooting the connections to AWS buckets, you should remove it or change to 0: wazuh_modules.debug=2
You'll be able to find those logs on /var/ossec/logs/ossec.log file. If you get something like follows, you can execute the script /var/ossec/wodles/aws/aws-s3 manually and add --debug 2 to find out what is happening on the execution:
- 2021/04/22 23:34:08 wazuh-modulesd:aws-s3[21386] wm_aws.c:382 at wm_aws_run_s3(): DEBUG: Launching S3 Command: /var/ossec/wodles/aws/aws-s3 --bucket waf-logs-bucket --access_key AKSSSSSEEECCCRREEETT2K --secret_key
AKSSSSSEEECCCRREEETTKKKEEEEYYY2K --only_logs_after 2021-APR-14 --type waf --debug 2 --skip_on_error
Hope this answers your question. Anything you need, please let me know, I'll follow up on this to help you.
Kind regards,
Cesar Moreno.