Skip to content

Instantly share code, notes, and snippets.

@foi
Created October 18, 2023 10:30
Show Gist options
  • Save foi/6d049a1efd87bc9a9bdc48ca66bab470 to your computer and use it in GitHub Desktop.
Save foi/6d049a1efd87bc9a9bdc48ca66bab470 to your computer and use it in GitHub Desktop.
glusterfs promtail parse rules example
server:
http_listen_port: 9080
grpc_listen_port: 0
log_level: debug
positions:
filename: /var/promtail/positions.yaml
clients:
- url: http://127.0.0.1:3100/loki/api/v1/push
scrape_configs:
- job_name: gluster-logs
static_configs:
- targets:
- localhost
labels:
job: gluster-logs
__path__: /var/log/glusterfs/**/*.log
env: prod
hostname: "ma.glusterfs1"
pipeline_stages:
- match:
selector: '{job="gluster-logs"} |~ "repeated \\d{1,2} times"'
action: drop
drop_counter_reason: drop_repeated_log_lines
- match:
selector: '{job="gluster-logs"} |= ": volume status all detail : SUCCESS"'
action: drop
drop_counter_reason: drop_repeated_cmd_success_log_lines
- multiline:
firstline: '^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{6}\]'
max_wait_time: 5s
max_lines: 1000
- regex:
expression: '^\[(?P<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{6})\] (?P<severity>[A-Z]*) (?P<message>(?s:.*))$'
- replace:
expression: '(\n)'
replace: ''
- timestamp:
source: time
location: "Asia/Krasnoyarsk"
format: "2006-01-02 15:04:05.999999"
- labels:
severity:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment