1

I am new to Promtail. I want to filter log lines with labeling using regex.

These are my log lines:

[DEBUG]: Starting the application
[PROCESS]: Trying a division
[WARNING]: dividing by zero(0) might cause an error
[ERROR]: Caught an exception: division by zero
[STATS]: 1 division has been tried in this run

This is my Promtail config:

server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

clients:
  - url: "http://loki:3100/loki/api/v1/push"

scrape_configs:
- job_name: logscraping
  static_configs:
  - targets:
      - localhost
    labels:
      job: logscraping
      __path__: /var/log/*.log
      test_label: test
  pipeline_stages:
  - regex:
      expression: '^\[(?P<severity>.*)].*$'
  - labels:
      severity:

I can see the labels values in Grafana as severity = DEBUG WARNING ERROR PROCESS STATS

but when I select any of them, nothing shows up. What config do I need to see the lines with their respective severity label?

NIGHTSCROLLER
  • 89
  • 1
  • 5

0 Answers0