-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Traefik module for Filebeat is not working as expected #6111
Comments
@e8kor Which version of Traefik are you using? Can you open a PR with the change so we support both options? |
hi, I'm using 1.4.6 and I believe that they will fix logging in 1.5.0. Pull request is coming. |
I came across this issue after hitting an error running filebeat with the traefik module against traefik 1.6 on Kubernetes:
Is the traefik module currently broken? I see the PR is somewhat stalled; is there anything I can do to help it along? |
Seems like we have 2 open PR's which could be related to this:
We should push these forward to make it into the code. |
…g Format (#8768) * Added support for Common Log Format and Combined Log Format in Traefik which is the default format until now. * Added more log lines, including one in Common Log Format * Added user_identifier field which was hardcoded to '-' before * Added log test inputs where the user_name and user_identifier were set and not set. * Added duration field which was missing * Numeric fields added as string have been converted to long * Added request count field * Added two log lines more that covers issue #6111 * Make bytes_sent field of type long. Most Grok expressions are optional now * Added CHANGELOG entry
…g Format (elastic#8768) * Added support for Common Log Format and Combined Log Format in Traefik which is the default format until now. * Added more log lines, including one in Common Log Format * Added user_identifier field which was hardcoded to '-' before * Added log test inputs where the user_name and user_identifier were set and not set. * Added duration field which was missing * Numeric fields added as string have been converted to long * Added request count field * Added two log lines more that covers issue elastic#6111 * Make bytes_sent field of type long. Most Grok expressions are optional now * Added CHANGELOG entry (cherry picked from commit 0e9054c)
…xed Common and Combined Log Format (#9419) * Update Filebeat Traefik module to handle mixed Common and Combined Log Format (#8768) * Added support for Common Log Format and Combined Log Format in Traefik which is the default format until now. * Added more log lines, including one in Common Log Format * Added user_identifier field which was hardcoded to '-' before * Added log test inputs where the user_name and user_identifier were set and not set. * Added duration field which was missing * Numeric fields added as string have been converted to long * Added request count field * Added two log lines more that covers issue #6111 * Make bytes_sent field of type long. Most Grok expressions are optional now * Added CHANGELOG entry (cherry picked from commit 0e9054c) * Updated fields.go file * Upload pre-ECS generated JSON expected file which differs from master
Fixed in #8768 |
…g Format (elastic#8768) * Added support for Common Log Format and Combined Log Format in Traefik which is the default format until now. * Added more log lines, including one in Common Log Format * Added user_identifier field which was hardcoded to '-' before * Added log test inputs where the user_name and user_identifier were set and not set. * Added duration field which was missing * Numeric fields added as string have been converted to long * Added request count field * Added two log lines more that covers issue elastic#6111 * Make bytes_sent field of type long. Most Grok expressions are optional now * Added CHANGELOG entry (cherry picked from commit 0e9054c) fields.go file is updated and pre-ECS generated JSON expected file which differs from master is used # Conflicts: # filebeat/include/fields.go # filebeat/module/traefik/access/test/test.log-expected.json
…xed Common and Combined Log Format (#9439) * Update Filebeat Traefik module to handle mixed Common and Combined Log Format (#8768) * Added support for Common Log Format and Combined Log Format in Traefik which is the default format until now. * Added more log lines, including one in Common Log Format * Added user_identifier field which was hardcoded to '-' before * Added log test inputs where the user_name and user_identifier were set and not set. * Added duration field which was missing * Numeric fields added as string have been converted to long * Added request count field * Added two log lines more that covers issue #6111 * Make bytes_sent field of type long. Most Grok expressions are optional now * Added CHANGELOG entry (cherry picked from commit 0e9054c) fields.go file is updated and pre-ECS generated JSON expected file which differs from master is used # Conflicts: # filebeat/include/fields.go # filebeat/module/traefik/access/test/test.log-expected.json
…ndle mixed Common and Combined Log Format (elastic#9439) * Update Filebeat Traefik module to handle mixed Common and Combined Log Format (elastic#8768) * Added support for Common Log Format and Combined Log Format in Traefik which is the default format until now. * Added more log lines, including one in Common Log Format * Added user_identifier field which was hardcoded to '-' before * Added log test inputs where the user_name and user_identifier were set and not set. * Added duration field which was missing * Numeric fields added as string have been converted to long * Added request count field * Added two log lines more that covers issue elastic#6111 * Make bytes_sent field of type long. Most Grok expressions are optional now * Added CHANGELOG entry (cherry picked from commit 5db2afb) fields.go file is updated and pre-ECS generated JSON expected file which differs from master is used # Conflicts: # filebeat/include/fields.go # filebeat/module/traefik/access/test/test.log-expected.json
Please post all questions and issues on https://discuss.elastic.co/c/beats
before opening a Github Issue. Your questions will reach a wider audience there,
and if we confirm that there is a bug, then you can open a new issue.
For security vulnerabilities please only send reports to security@elastic.co.
See https://www.elastic.co/community/security for more information.
For confirmed bugs, please report:
Linux 4.4.0-31-generic [question] Failed to publish topology #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Traefik access log example:
Grok pattern:
link: https://github.com/elastic/beats/blob/master/filebeat/module/traefik/access/ingest/pipeline.json#L7
pattern:
%{IPORHOST:traefik.access.remote_ip} - %{DATA:traefik.access.user_name} \[%{HTTPDATE:traefik.access.time}\] "%{WORD:traefik.access.method} %{DATA:traefik.access.url} HTTP%{NUMBER:traefik.access.http_version}" %{NUMBER:traefik.access.response_code} (?:%{NUMBER:traefik.access.body_sent.bytes}|-)( "%{DATA:traefik.access.referrer}")?( "%{DATA:traefik.access.agent}")?(?:%{NUMBER:traefik.access.request_count}|-)?( "%{DATA:traefik.access.frontend_name}")?( "%{DATA:traefik.access.backend_url}")?
Resut:
error: field [agent] not present as part of path [traefik.access.agent]
From what I understand is that current pattern is not working properly its not parsing data since user_agent field.
here is example of pattern that works for me:
initial (pattern for support of old version of traefik):
%{IPORHOST:traefik.access.remote_ip} - (?:-|"%{DATA:traefik.access.user_name}") \[%{HTTPDATE:traefik.access.time}\] "%{WORD:traefik.access.method} %{DATA:traefik.access.url} HTTP/%{NUMBER:traefik.access.http_version}" (?:-|%{NUMBER:traefik.access.response_code:int}) (?:-|%{NUMBER:traefik.access.body_sent.bytes:int}) "(?:-|%{DATA:traefik.access.referrer})" "(?:-|%{DATA:traefik.access.agent})" (?:-|%{NUMBER:traefik.access.request_count:int}) (?:-|"%{DATA:traefik.access.frontend_name}") (?:-|"%{DATA:traefik.access.backend_url}") %{NUMBER:traefik.access.duration:int}ms
fallback (pattern for support of new version of traefik):
%{IPORHOST:traefik.access.remote_ip} - (?:-|"%{DATA:traefik.access.user_name}") \[%{HTTPDATE:traefik.access.time}\] "%{WORD:traefik.access.method} %{DATA:traefik.access.url} HTTP/%{NUMBER:traefik.access.http_version}" (?:-|%{NUMBER:traefik.access.response_code:int}) (?:-|%{NUMBER:traefik.access.body_sent.bytes:int}) (?:-|"%{DATA:traefik.access.referrer}") (?:-|"%{DATA:traefik.access.agent}") (?:-|%{NUMBER:traefik.access.request_count:int}) (?:-|"%{DATA:traefik.access.frontend_name}") (?:-|"%{DATA:traefik.access.backend_url}") %{NUMBER:traefik.access.duration:int}ms
patterns are based on: https://github.com/containous/traefik/blob/5140bbe99a79b45f98c27fbb8e9b6833194af4cb/middlewares/accesslog/logger_formatters.go
related discussion: https://discuss.elastic.co/t/traefik-module-for-filbeat-dont-parse-traefik-logs/116170/3
Pipeline that works for me
pipeline.json
The text was updated successfully, but these errors were encountered: