I have the following rsyslog config:
template(name="logz.io" type="string" string="[TOKEN]
<%pri%>%protocol-version% %timestamp:::date-rfc3339% [hostname]
%app-name% %procid% %msgid% tag=\"syslog\"] %msg%\n")
# Send messages over TCP using the template.
action(type="omfwd" protocol="tcp" target="listener.logz.io" port="5001"
template="logz.io" StreamDriver="gtls" StreamDriverMode="1"
StreamDriverAuthMode="x509/name" StreamDriverPermittedPeers="*.logz.io")
Now I would like to have the type="string"
set according to one of the message type. So I could create individual templates for each type like
template(name="logz.io_nginx" type="nginx" string="[TOKEN]
<%pri%>%protocol-version% %timestamp:::date-rfc3339% [hostname]
%app-name% %procid% %msgid% tag=\"nginx\"] %msg%\n")
However this means that the action should call the correct template based on the type.
- How would I configure rsyslog to use the same action with different template?
- Could I just have one template but for example the
type
parameter dynamically set dependent on the message type?