Process custom log levels

Hi,

I’m starting with Loki in a docker environment. Logs are already transmitted to loki using the loki docker driver. On the grafana/loki side the loglevels are not recognized.

My app send the loglevel as a 3 character constant: INF, ERR, WRN, CRI.
AFAIK Loiki expects here a hard-coded list of loglevels: error, warning, information.

What is here the best practice? Can the logLevels be customized (per client) or must all clients implement the loglevels loki expects? Is there maybe some kind of pipeline with which Loki can “transform” the loglines before importing them?

Thanks

Hi,

If you are using a recent version there have been some news features to simplify log parsing :

And of course Loki is customizable you can transform your logs using different parser :

Hope it helps.

Good Luck

Hi @wlargou,

thanks a lot. Yout hint with the pattern parser helped me already a lo to extract the loglevel into a label. Is there also a way to extract it into loki “native loglevel” with doing a substitude.

Hi,

I don’t think there is something natively, but you can convert levels to labels, i suggest you have a look at this discussion :

Hope it helps.

Good Luck

1 Like

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