I’m managing some server which run a custom daemon. This daemon is managed via SystemD and logging is accessed via journalctl
.
I’m wondering how I can post progress the log of this daemon with Telegraf. There doesn’t seem a SystemD input and the logparser
requires a file (I believe).
Is it possible to write the journalctl logs into a file ?
If yes, then you can make a cronjob to write it every minute to a file.
I would like to know your views on this.
Huh, I didn’t think of that. So something like:
#!/bin/sh
journalclt --unit=my-daemon >> /tmp/logs/my-daemon.log
Run this with cron ever so often.
Use the logparser
plugin of Telegraf.
That would work I think. Still feels like a hack but it would work.
I’m still open to other ideas.
Talking about logparser,
If I give 2 files to parse,
files=['file1.log','file2.log']
But We can give only one measurement
measurement = 'name1'
, which means both log files will be stored under 1 measurement name.
If I wanted 2 measurements, 1 for file1.log and 1 for file2.log
How can I make different measurement for the different files ?
Make two different [[input.logparser]] configuration blocks?
It appears possible to define an input block twice: telegraf/CONFIGURATION.md at master · influxdata/telegraf · GitHub