Using Telegraf to input Logs into Loki?

So I’m running into an issue. I have a device (OPNsense) that obviously doesn’t have the plugin for Promtail, BUT, I found you could forward the logs from within the telegraf.conf plugin (which Telegraf OPNsense does have) and do an [[outputs.loki]] and forward it to the specific server that loki is on. Works great, but what I don’t understand is how can I use the Labels from within the config-promtail.yml or something similar so I can create a label for “nodename” or “device”.

My understanding with Labels is only if you have Promtail on said device and then do all the options from config-promtail.yml, but since my said server (OPNsense) doesn’t have Promtail, but I can forward the system logs from telegraf, I don’t know how to set up the labels (if I even can…) correctly. Because whatever I put from the examples from the Labels, nothing works (whereas if I had Promtail on device, it would work). Plus I don’t even need to create a Label to begin with, if forwarding logs to Loki using telegraf. The logs still show up on Grafana > Explore.

Anything I can do to sort these better?

Hi,

looking at the Loki output for Telegraf docs, it says This plugin sends logs to Loki, using tags as labels. Can you set your tags on the Telegraf input?

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