I am looking to alert on a specific log message.
First I match based on the file name and extract some data from each log line.
This all works just fine.
After this I add another match nested under the stages section. I get an error from promtail - Unable to parse config … did not find expected key.
The end goal is to be able to alert on a specific message. If there is a better way to accomplish that, I am all ears.
Here is an example of what I am trying to do:
- match:
selector: ‘{filename=~".stdout."}’
stages:
- json:
expressions:
logType:
timeMillis:
date:
time:
server:
port:
thread:
level:
message:
- template:
source: outputMsg
template: ‘{{ .date }} {{ .time }} {{ .logType }} {{ .level }} {{ .message }}{{ .thread }}{{ .server }}:{{ .port }}’
- timestamp:
source: “timeMillis”
format: UnixMs
- labels:
logType:
port:
level:
- output:
source: outputMsg
- match:
selector: ‘{message=~".CONNECTION FAILED."}’
stages:
- metrics:
failed_connection:
prefix: log_
type: Counter
description: “Connection Failure”
source: “message”
config:
action: inc