loggingsyslogrsyslog

Syslog doesn't send messages over UDP


I want to send logs to a remote server using rsyslog. Somehow rsyslog doesn't send any messages.

This is my config (I am using the new syntax):

template(name="myTemplate"
    type="string"
    string="%timegenerated% %HOSTNAME% %syslogfacility-text%.%syslogseverity-text%")

local7.* {
    action(type="ofwd" target="192.168.1.10" port="514" protocol="udp")
}

I can't seem to figure out what I am doing wrong.


Solution

  • You forgot to include the message in your template. I am not sure though, if it would be sent anyways - just without a message - or if it would be discarded.

    To solve that, just append %msg% to the template string:

    template(name="myTemplate"
        type="string"
        string="%timegenerated% %HOSTNAME% %syslogfacility-text%.%syslogseverity-text% %msg%")
    

    The reason why you're logs aren't being forwarded though, is because you're using the incorrect module name in the action. It should be omfwd instead of ofwd:

    local7.* {
        action(type="omfwd" target="192.168.1.10" port="514" protocol="udp")
    }