I am testing loki and promtail, using version 2.9.7, but I encountered a strange problem
Here is a demo log
03:13:11.036 1997908 [pool-4-thread-4] INFO com.xxxxxx.biz.event.XxxxxMessageListener:63 11111111111
03:13:11.161 1997908 [orderpayExecutor-4] ERROR o.s.a.i.ExceptionHandler:39 222222222
33333333
444444444
03:13:35.020 1997908 [pool-4-thread-5] INFO com.xxxxxx.biz.event.XxxxxMessageListener:58 55555555
03:13:35.020 1997908 [pool-4-thread-5] INFO com.xxxxxx.biz.event.XxxxxMessageListener:63 66666666
03:20:40.730 1997908 [pool-4-thread-6] INFO com.xxxxxx.biz.event.XxxxxMessageListener:58 7777777
My promtail configuration file is as follows
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
scrape_configs:
- job_name: xnxb-01-logs
pipeline_stages:- multiline:
firstline: '^\d{2}:\d{2}:\d{2}.\d{3} ’
max_wait_time: 3s
max_lines: 1000 - regex:
source: filename
expression: ‘.*/xnxb-(?P[^-]+)-(?P\d{4}-\d{2}-\d{2})-\d{1,3}.log’ - regex:
expression: ‘^(?P\d{2}:\d{2}:\d{2}.\d{3})\s+(?P\d+)\s+[(?P[^]]+)]\s+(?P[A-Z]+)\s+(?P[^\s]+):(?P\d+)\s+(?P(.|\n)*)$’ - template:
source: dt
template: ‘{{ .date }} {{ .time }}’ - labels:
service:
time: dt
level:
thread:
class:
line: - timestamp:
source: dt
format: “2006-01-02 15:04:05.000”
location: “Asia/Shanghai” - output:
source: message
static_configs: - targets:
- localhost
labels:
job: xnxb-01-logs
path: /opt/promtail/xnxb-platform-2024-04-28-3.log
- localhost
- multiline:
When testing with the --dry-run parameter, you can see that the generated labels and information are normal.
Remove the --dry-run parameter for actual testing and no error is reported.
But when I go back to loki, I can’t find anything. Now I look at the label browser and I can see the labels I pushed.
But I can’t find these logs in Loki. Can anyone help me?