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 55a3f0a
Show file tree
Hide file tree
Showing 2 changed files with 19 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.
18 changes: 18 additions & 0 deletions parsers/s01-parse/crowdsecurity/traefik-logs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
debug: true
filter: "evt.Parsed.program startsWith 'traefik'"
onsuccess: next_stage
pattern_syntax:
TRAEFIK_ROUTER: '%{USER}@%{URIHOST}'
# 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}|\-)" "(%{URI: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 55a3f0a

Please sign in to comment.