Graph data from log

We are capturing our logs with promtail into loki.

We have log lines like this:

...
some prefix duration: 102.03 ms some more text...
some prefix duration: 309.19 ms some more text...
some prefix duration: 426.43 ms some more text...
some prefix duration: 572.82 ms some more text...
...

I want to see a graph of the duration from these log lines.

I entered this query in a Grafana Dashboard in a time series panel with the loki data source:

{host="somehostname",filename="/path/to/some.log"}    # filtering the logfile
|= "some prefix duration:"    # filtering just the lines with duration
| pattern "<_> duration: <duration> ms"    # get the duration from line with a pattern

I used some Transformations:

  • Labels to fields
  • Convert field type
  • Merge

image

I see a graph, but it is cut off at the line limit (default 1000).

Looks like I have to make time series from data coming from a logline. Any suggestions?

Hi…

To make the dashboard to have time series, you need timestamp in the log, then loki will find the timestamp as time series field and Grafana will vizualized in timeseries…

Regards,
Fadjar Tandabawana

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.