How can we show the occurrence of a string at particular time at grafana

Hi,

We wrote a script that reads from a file and sends the metrics to InfluxDB.
In that script we are sending the following metrics:

  1. time,
  2. measurement,
  3. fields: host, log level, URL, processing time
  4. tags: host, log level, URL

In the above parameters, except processing time, everything is in string format.

Now the issue is,
We want to see the log level at dashboards i.e., we have different log levels like INFO, DEBUG, CRITICAL, ERROR, WARN etc.,
We want to see when the ERROR or CRITICAL logs occur at which time.

We made a dashboard but we think it won’t works. The query is:

A FROM default django_metric WHERE host =~ /^$HOST$/ AND loglevel =~ /^$Loglevel$/
SELECT field (loglevel) mean ()
GROUP BY time ($__interval) fill (none)
FORMAT AS TIME SERIES

Can you help us to resolve this issue?.
If you want any inputs, we will update here.

Thank you…

if loglevel is string, you cannot aggreate it using mean aggregation.

Read InfluxDB docs on details on the query language.

Hi @torkel
Sorry, we tried different aggregators, but we weren’t able to resolve that.
Can you please help us ?.

Thank you…

Not sure how. What you want to do is not supported by InfluxDB.

Hi @torkel
Not a problem, we made like, we took the count of the string(occurrences of it at a certain time).
It helps for now.

A FROM default django_metric WHERE host =~ /^$HOST$/ AND loglevel =~ /^$Loglevel$/
SELECT field (loglevel) count ()
GROUP BY time ($__interval) fill (none)
FORMAT AS TIME SERIES
ALIAS BY Log level Count

Thank you…