I want to write messages from rsyslog
to kafka, use rsyslog $programname
or $syslogtag
as topic, however, omkafaka plugin didn't accept params, how can I achieve this?
I have tried using (type="omkafka" topic="$programname" ...)
, it fails.
I solved this by myself, omkafka 8.xx have a new property to accept dynamic topic, just config the property and add a template to inject dynamic topic.
template(name="kafka_topic" type="string" string="%programname%")
input(type="imtcp" port="10514")
action(type="omkafka" topic="kafka_topic" dynatopic="on" dynatopic.cachesize="1000" template="msg_template" broker=["xxx", "xxx", "xxx", "xxx"])