-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dissect to traefik/access metricset for first stage of processing
This should provide an example use case on how grok and dissect can be combined. The resulting outcome should be identical. The main difference is that now some of the fields can be used on the Beats side for filtering out events.
- Loading branch information
Showing
3 changed files
with
75 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,70 @@ | ||
{ | ||
"description": "Pipeline for parsing Traefik access logs. Requires the geoip and user_agent plugins.", | ||
"processors": [{ | ||
"grok": { | ||
"field": "message", | ||
"patterns":[ | ||
"%{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}\")?" | ||
], | ||
"ignore_missing": true | ||
"processors": [ | ||
{ | ||
"grok": { | ||
"field": "traefik.access.message", | ||
"patterns": [ | ||
"(?:%{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}\")?" | ||
], | ||
"ignore_missing": true | ||
} | ||
}, | ||
{ | ||
"remove": { | ||
"field": "message" | ||
} | ||
}, | ||
{ | ||
"remove": { | ||
"field": "traefik.access.message" | ||
} | ||
}, | ||
{ | ||
"rename": { | ||
"field": "@timestamp", | ||
"target_field": "read_timestamp" | ||
} | ||
}, | ||
{ | ||
"date": { | ||
"field": "traefik.access.time", | ||
"target_field": "@timestamp", | ||
"formats": [ | ||
"dd/MMM/YYYY:H:m:s Z" | ||
] | ||
} | ||
}, | ||
{ | ||
"remove": { | ||
"field": "traefik.access.time" | ||
} | ||
}, | ||
{ | ||
"user_agent": { | ||
"field": "traefik.access.agent", | ||
"target_field": "traefik.access.user_agent", | ||
"ignore_failure": true | ||
} | ||
}, | ||
{ | ||
"remove": { | ||
"field": "traefik.access.agent" | ||
} | ||
}, | ||
{ | ||
"geoip": { | ||
"field": "traefik.access.remote_ip", | ||
"target_field": "traefik.access.geoip" | ||
} | ||
} | ||
},{ | ||
"remove":{ | ||
"field": "message" | ||
], | ||
"on_failure": [ | ||
{ | ||
"set": { | ||
"field": "error.message", | ||
"value": "{{ _ingest.on_failure_message }}" | ||
} | ||
} | ||
}, { | ||
"rename": { | ||
"field": "@timestamp", | ||
"target_field": "read_timestamp" | ||
} | ||
}, { | ||
"date": { | ||
"field": "traefik.access.time", | ||
"target_field": "@timestamp", | ||
"formats": ["dd/MMM/YYYY:H:m:s Z"] | ||
} | ||
}, { | ||
"remove": { | ||
"field": "traefik.access.time" | ||
} | ||
}, { | ||
"user_agent": { | ||
"field": "traefik.access.agent", | ||
"target_field": "traefik.access.user_agent", | ||
"ignore_failure": true | ||
} | ||
}, { | ||
"remove": { | ||
"field": "traefik.access.agent" | ||
} | ||
}, { | ||
"geoip": { | ||
"field": "traefik.access.remote_ip", | ||
"target_field": "traefik.access.geoip" | ||
} | ||
}], | ||
"on_failure" : [{ | ||
"set" : { | ||
"field" : "error.message", | ||
"value" : "{{ _ingest.on_failure_message }}" | ||
} | ||
}] | ||
] | ||
} |