Hello Grafana Experts,
I have below log line which I have ingested in Grafana loki and now I want to extract the timestamp and ResponseTime from this log line.
Log Query : {domain=“dev1”, env=“dev”, job=“access-logs”} |~ SNCalculateQuoteSalesTaxServiceV2 | regexp (?P<timeStamp>(?P<date>\S+\s[0-9]+:[0-9]+):[0-9]+)\s(?P<responseTime>\S+)\s(?P<httpMethod>\S+)\s(?P<ecid>\S+)\s\S+\s(?P<uri>\S+)\s(?P<httpResponse>\S+)\s\S+
My goal is to create Time series using timestamp and responseTime and create an alert if responseTime is greater than 1secs.
It would be appreciate if can help me on this
You don’t need timestamp, your ruler should naturally be processing your queries for the past however minutes specified.
Try this (not tested)
max(
max_over_time(
{domain="dev1", env="dev", job="access-logs"}
|~ SNCalculateQuoteSalesTaxServiceV2
| regexp `(?P<timeStamp>(?P<date>\S+\s[0-9]+:[0-9]+):[0-9]+)\s(?P<responseTime>\S+)\s(?P<httpMethod>\S+)\s(?P<ecid>\S+)\s\S+\s(?P<uri>\S+)\s(?P<httpResponse>\S+)\s\S+`
| unwrap responseTime
| __error__=""
[5m]
)
)
system
Closed
3
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.