Hi, i am trying to count number of lines based on text string in them and send that info to prometheus_client.
My log file looks like this:
2018-05-25T11:09:59.084943+00:00 somehost-a0-2ut appname: Use of uninitialized value in join or string at /usr/local/lib/...
2018-05-25T11:10:00.345101+00:00 somehost-c4-yac othername: splice() offset past end of array at /usr/local/lib/...
2018-05-25T11:10:01.148878+00:00 somehost-a3-2ut somthing: Retrying (403) https://s3-eu-west-1.amazonaws.com/something/...
Could you help me writing correct pattern?
[[inputs.logparser]]
files = ["/var/log/some-file-*.log"]
from_beginning = false
[inputs.logparser.grok]
pattern: "[.* ]%{C_TEXT:error_count}[ .*]"
custom_patterns: [ "C_TEXT somehost-.*" ]
measurement = "errors_count"
timezone = "UTC"
I can see these lines in outputs.file, but not in prometheus_client…
As suggested i added “modifier”:
pattern: "[.* ]%{C_TEXT:error_count:int}[ .*]"
But that seem to generate E! Error parsing log line: logparser_grok: must have one or more fields
I am trying to grep number or error lines per time period and push that data into prometheus_client - Is that even possible?