Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filebeat S3 input support for AWS WAF logs (support application/octet-stream) #25296

Closed
rubal033 opened this issue Apr 24, 2021 · 7 comments
Closed
Labels
enhancement Filebeat Filebeat Team:Integrations Label for the Integrations team

Comments

@rubal033
Copy link

Filebeat S3 input support for AWS WAF logs (support application/octet-stream)

As of now, there is Filebeat s3 input that doesn't support AWS WAF logs. AWS WAF logs use Kinesis Firehose to get to S3 and the "Content-type" is set to "application/octet-stream". Due to this, the logs didn't get expanded in the Elasticsearch.

If that support can be added it will resolve a big problem and many users looking forward to getting AWS WAF logs to the ELK stack for the analysis.

Thanks in Advance

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Apr 24, 2021
@ycombinator ycombinator added the Team:Integrations Label for the Integrations team label Apr 26, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Apr 26, 2021
@legoguy1000
Copy link
Contributor

legoguy1000 commented Apr 29, 2021

Can you provide more details? Are u saying the WAF logs aren't plain text files? Can you provide sample logs? Looking at this, https://www.wafcharm.com/en/blog/aws-waf-full-log-s3-output/, it should be json logs in the s3 bucket?

@rubal033
Copy link
Author

AWS WAF logs are in JSON format but when Kinesis Firehose put them in s3 bucket it set the metadata "content-type" to "application/octet-stream" instead of "application/json".

So when filebeat s3 plugin read that data it gets its content type as "application/octet-stream" and not able to expand to get the JSON field read properly in Elasticsearch. The whole JSON log get inside "message" field.

Screenshot 2021-04-30 at 9 43 15 PM

@andrewkroh
Copy link
Member

The aws-s3 input allows you to override the Content-Type by setting content_type. So if you set content_type: application/json then the content will be parsed as JSON.

https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-input-aws-s3.html#input-aws-s3-content_type

@andrewkroh
Copy link
Member

I think we can close this given we have a solution for the Content-Type. There's a separate request in #28121 to add AWS WAF to the Filebeat AWS module.

@andrewkroh
Copy link
Member

Fixed by #25772

@rubal033
Copy link
Author

rubal033 commented Oct 7, 2021

Thank you !

That is really helpful. I will try it and post my observations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Filebeat Filebeat Team:Integrations Label for the Integrations team
Projects
None yet
Development

No branches or pull requests

5 participants