Pipe docker logs into influxdb

Hello all. I’m new to the influx family.

I currently have a work of collecting the docker logs stdout and alert through grafana if any keyword “panic” exist in the log.

My first attempt is to use a small python script to mimic tail -f on the /var/lib/docker/containers/{container-id}/{container-id}.log , but it seems not that stable as it does not handle the file correctly after some rollover event or sth.

My second attempt is to use an alternative docker logger, with one found here: https://github.com/donaldinos/docker-influxdb-log-driver . This seems to work, but it does not capture the severity explicitly as a value. So I need, and I stuck at querying the number of message that contains the string “panic”.

Can anyone lend a helping hand to me for my situation?

@orbit are you using Flux to process the captured logs? There is a containsStr function that might help you, docs here.