On a brand new local promtail+loki+grafana setup, I’m trying to parse a small logfile produced a week ago to get familiar with loki-grafana.
If I use the following pipeline, I can see log entries in grafana parsed correctly (note I’m using timestamp2 as a label). Log entries show a “timestamp2” label and the timestamp of the log is the current time (not the time parsed from the log file)
pipeline_stages:
- regex:
expression: '^(?P<level>\w+) (?P<timestamp2>\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}) (?P<file_path>[^\s]+):(?P<line_number>\d+): (?P<message>.*)$'
- labels:
level:
file_path:
line_number:
timestamp2:
- output:
source: message
so, I believe the regex at least is correct as it’s able to parse the log information into labels.
However, when I try using the timestamp from the log file:
pipeline_stages:
- regex:
expression: '^(?P<level>\w+) (?P<timestamp>\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}) (?P<file_path>[^\s]+):(?P<line_number>\d+): (?P<message>.*)$'
- timestamp:
source: timestamp
format: "2006/01/02 15:04:05"
- labels:
level:
file_path:
line_number:
- output:
source: message
then I am not able to see any log entries in grafana. I’ve tried searching for the last 30 days (the log entries are from last week) but I still do not see the entries in grafana.
Manually searching on the wal files in loki, I can see they contain the entries I’m trying to display, but for some reason I’m still not able to display them in grafana.
Between my tests, I’m deleting promtail’s position files, loki’s /tmp/loki folder.
The loki configuration I’m using the the following:
auth_enabled: false
server:
http_listen_port: 3100
common:
ring:
instance_addr: 127.0.0.1
kvstore:
store: inmemory
replication_factor: 1
path_prefix: /tmp/loki
schema_config:
configs:
- from: 2020-05-15
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
storage_config:
filesystem:
directory: /tmp/loki/chunks
limits_config:
reject_old_samples: false
reject_old_samples_max_age: 43800h
retention_period: 744h
Does anybody have a suggestion on how to troubleshoot this further? or some minimal example I can follow?