Skip to content

Commit

Permalink
Add basic traefik parser
Browse files Browse the repository at this point in the history
  • Loading branch information
gmelodie committed Oct 27, 2021
1 parent b8ef5b5 commit f45a106
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions parsers/s01-parse/crowdsecurity/traefik-logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This traefik parser supports access logs in the Common Log Format ([defined here for Traefik](https://doc.traefik.io/traefik/observability/access-logs/#format)) and JSON formats.
19 changes: 19 additions & 0 deletions parsers/s01-parse/crowdsecurity/traefik-logs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
debug: true
filter: "evt.Parsed.program startsWith 'traefik'"
onsuccess: next_stage
pattern_syntax:
TRAEFIK_ROUTER: '(%{USER}@%{URIHOST}|\-)'
TRAEFIK_SERVER_URL: '(%{URI}|\-)'
# for json just use TIMESTAMP_ISO8601
name: crowdsecurity/traefik-logs
description: "Parse Traefik access logs"
#
grok:
pattern: '%{NGINXACCESS} %{NUMBER:number_of_requests_received_since_traefik_started} "%{TRAEFIK_ROUTER:traefik_router_name}" "%{TRAEFIK_SERVER_URL:traefik_server_url}" %{NUMBER:request_duration_in_ms}ms'
apply_on: message
# statics:
# - meta: log_type
# value: http_access-log
# - parsed: is_my_service
# value: yes

0 comments on commit f45a106

Please sign in to comment.