-
Notifications
You must be signed in to change notification settings - Fork 444
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
Enhance traefik integration to also handle JSON-formatted access logs #770
Enhance traefik integration to also handle JSON-formatted access logs #770
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪 |
9d567da
to
4538ac7
Compare
@mtojek I could use a second pair of eyes on why the system tests are failing for this PR. The symptom is that no documents can be found in the data stream:
I am able to reproduce this locally. While the system test is still running, I checked that the Elastic Agent container has the log files mounted as expected:
I also checked the policy in the Fleet UI and it looks right too:
I also checked that the ingest pipelines are loaded as expected:
{
"logs-traefik.access-0.0.1" : { ... },
"logs-traefik.access-0.0.1-format-json" : { ... },
"logs-traefik.access-0.0.1-format-common" : { ... }
} Note that pipeline tests are passing. |
I looked into filebeat's logs and found this one (file:
|
Thanks for looking into it, @mtojek, appreciate it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the JSON support.
- append: | ||
field: related.ip | ||
value: "{{source.ip}}" | ||
if: "ctx?.source?.ip != null" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend adding allow_duplicates: false
to the append
processors for "related" fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why not do this for all append
processors, e.g. the ones for event.category
or event.type
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, in most cases it probably makes sense to deduplicate the append
.
- append: | ||
field: related.user | ||
value: "{{user.name}}" | ||
if: "ctx?.user?.name != null && ctx.user.name != '-'" | ||
on_failure: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears we have all the fields populated to support the community_id
processor. Can you add that in?
edit: We'd need to set a static network.transport: tcp
to make it work. But I think this makes sense for an http proxy.
field: destination.address | ||
copy_from: destination.ip | ||
if: "ctx?.destination?.ip != null" | ||
- rename: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RequestAddr looks like it could be used to populate url.domain.
1e2f800
to
deb8179
Compare
…elastic#770) * Migrating traefik module * Formatting package files * Removing invalid path field * Adding categories * Formatting tweaks * Adding pipeline test files * Adding YAML header * Adding system tests * Renaming pipeline test case files * Fixing pipeline tests * Adding sample event for health data set * Adding system test for access data stream * Adding README * Starting to handle JSON formatted logs * Adding ARG to Dockerfile for log format * Adding sample JSON logs * Running elastic-package format * Removing host field from sample event * Fix docker compose file * Splitting in commonlog and json format pipelines * Making pipeline test pass * Updating README.md * Address TODOs in pipeline * Specify services in system test configs * Refactoring out common processors into common pipeline * Add @timestamp field * Adding service to health data stream system test * Adding CHANGELOG entries * Parsing out event.duration * Regenerating sample events * Updating README * Add allow_duplicates: false for related.* fields' append processors * Adding community_id processor * Populating url.domain * Set allow_duplicates: false for other append processors * Regenerating README
What does this PR do?
This PR enhances the
traefik
integration to parse JSON-formatted access logs. Prior to this PR thetraefik
integration could only parse commonlog-formatted access logs.Checklist
changelog.yml
file.Related issues