<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Setting up Splunk monitoring of rsyslog with UDP in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375842#M94799</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;# rsyslog configuration file

# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
# If you experience problems, see &lt;A href="http://www.rsyslog.com/doc/troubleshoot.html" target="test_blank"&gt;http://www.rsyslog.com/doc/troubleshoot.html&lt;/A&gt;

#### MODULES ####

# The imjournal module bellow is now used as a message source instead of imuxsock.
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imjournal # provides access to the systemd journal
#$ModLoad imklog # reads kernel messages (the same are read from journald)
#$ModLoad immark  # provides --MARK-- message capability

# Provides UDP syslog reception
$ModLoad imudp
$InputUDPServerRun 2500

# Provides TCP syslog reception
#$ModLoad imtcp
#$InputTCPServerRun 2048

#$InputTCPServer BindRuleset remote
#$TCPServerRun 2048





#### GLOBAL DIRECTIVES ####

# Where to place auxiliary files
$WorkDirectory /var/lib/rsyslog

# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# File syncing capability is disabled by default. This feature is usually not required,
# not useful and an extreme performance hit
#$ActionFileEnableSync on

# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf

# Turn off message reception via local log socket;
# local messages are retrieved through imjournal now.
$OmitLocalLogging on

# File to store the position in the journal
$IMJournalStateFile imjournal.state

#### RULES ####

# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.*                                                 /dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none                /var/log/messages

# The authpriv file has restricted access.
authpriv.*                                              /var/log/secure

# Log all the mail messages in one place.
mail.*                                                  -/var/log/maillog


# Log cron stuff
cron.*                                                  /var/log/cron

# Everybody gets emergency messages
*.emerg                                                 :omusrmsg:*

# Save news errors of level crit and higher in a special file.
uucp,news.crit                                          /var/log/spooler

# Save boot messages also to boot.log
local7.*                                                /var/log/boot.log

# ### begin forwarding rule ###
# The statement between the begin ... end define a SINGLE forwarding
# rule. They belong together, do NOT split them. If you create multiple
# forwarding rules, duplicate the whole block!
# Remote Logging (we use TCP for reliable delivery)
#
# An on-disk queue is created for this action. If the remote host is
# down, messages are spooled to disk and sent when it is up again.
#$ActionQueueFileName fwdRule1 # unique name prefix for spool files
#$ActionQueueMaxDiskSpace 1g   # 1gb space limit (use as much as possible)
#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
#$ActionQueueType LinkedList   # run asynchronously
#$ActionResumeRetryCount -1    # infinite retries if host is down
# ### end of the forwarding rule ###

$template RemoteHost, "/opt/splunk/var/log/syslog/%HOSTNAME%/%FROMHOST-IP%.log"

*.* ?RemoteHost
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is my rsyslog.conf file. I changed it a bit as part of my trying to get it to work, so it's not exactly the same as it is above, so feel free to tell me if I screwed it up.&lt;/P&gt;</description>
    <pubDate>Tue, 08 May 2018 08:34:02 GMT</pubDate>
    <dc:creator>leongchongyu</dc:creator>
    <dc:date>2018-05-08T08:34:02Z</dc:date>
    <item>
      <title>Setting up Splunk monitoring of rsyslog with UDP</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375837#M94794</link>
      <description>&lt;P&gt;I am running Splunk on an RHEL7 VM. I wish to be able to receive data from a Lexmark printer, which I have configured to send its logs through UDP to the VM's IP address on port 2500. I have also configured Splunk to monitor /opt/splunk/var/log/syslog/test.log for data through a data input. In my /etc/rsyslog.conf, I have the following configurations:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$ModLoad imudp
$UDPServerRun 2500
*.* /opt/splunk/var/log/syslog/test.log
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, when I trigger an event on the printer, it does not appear to log data to the test.log file. What could be the cause of this problem? I have tested the connectivity between the printer and the VM and it appears to be fine - for instance I can use a direct data connection to transfer data to Splunk. But for some reason it doesn't seem to able to send to the test.log file for Splunk to monitor.&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 03:42:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375837#M94794</guid>
      <dc:creator>leongchongyu</dc:creator>
      <dc:date>2018-05-07T03:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up Splunk monitoring of rsyslog with UDP</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375838#M94795</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;

&lt;P&gt;This obviously seems to be an syslog issue rather than a Splunk issue. &lt;/P&gt;

&lt;P&gt;Two approaches:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;use tcpdump to verify that data is actually received by your server, e.g. &lt;CODE&gt;tcpdump -i eth0 udp port 2500&lt;/CODE&gt;, then send something and check if tcpdump looks fine (post it here if in doubt)&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;syslog-ng has proven to be easier to configure and to debug, so you might think about switching to it if you're just getting started with your syslog setup.&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Hope that helps! &lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 16:41:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375838#M94795</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-05-07T16:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up Splunk monitoring of rsyslog with UDP</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375839#M94796</link>
      <description>&lt;P&gt;Thank you for your prompt and informative response. I will switch to syslog-ng and try to use that instead.&lt;/P&gt;</description>
      <pubDate>Tue, 08 May 2018 01:51:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375839#M94796</guid>
      <dc:creator>leongchongyu</dc:creator>
      <dc:date>2018-05-08T01:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up Splunk monitoring of rsyslog with UDP</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375840#M94797</link>
      <description>&lt;P&gt;Not much experience with syslog-ng, so can't confirm that would be easier. I think if you use the modern rsyslog syntax it is not massively different from syslog-ng. But basically your rsyslog config looks fine, so not too much of a point switching to another syslog daemon just to resolve this issue.&lt;/P&gt;

&lt;P&gt;Indeed, start with using tcpdump to check if data is even coming in.&lt;/P&gt;

&lt;P&gt;If so:&lt;BR /&gt;
- confirm there is no firewall blocking it from reaching rsyslog (tcpdump sniffs before the firewall)&lt;BR /&gt;
- confirm with netstat that rsyslog is indeed listening on that UDP port&lt;BR /&gt;
- confirm rsyslog has permission to write to the indicated directory &lt;BR /&gt;
- check /var/log/messages (or wherever rsyslog writes its own log) to check for rsyslog daemon errors.&lt;BR /&gt;
- if there is nothing overly sensitive in it: post the entire rsyslog config file, just to check there is not something else in there that breaks your simple UDP input and file output config.&lt;/P&gt;</description>
      <pubDate>Tue, 08 May 2018 08:02:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375840#M94797</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-05-08T08:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up Splunk monitoring of rsyslog with UDP</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375841#M94798</link>
      <description>&lt;P&gt;Thank you so much! This was very helpful to me as I was struggling with setting up syslog-ng. &lt;/P&gt;</description>
      <pubDate>Tue, 08 May 2018 08:28:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375841#M94798</guid>
      <dc:creator>leongchongyu</dc:creator>
      <dc:date>2018-05-08T08:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up Splunk monitoring of rsyslog with UDP</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375842#M94799</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;# rsyslog configuration file

# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
# If you experience problems, see &lt;A href="http://www.rsyslog.com/doc/troubleshoot.html" target="test_blank"&gt;http://www.rsyslog.com/doc/troubleshoot.html&lt;/A&gt;

#### MODULES ####

# The imjournal module bellow is now used as a message source instead of imuxsock.
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imjournal # provides access to the systemd journal
#$ModLoad imklog # reads kernel messages (the same are read from journald)
#$ModLoad immark  # provides --MARK-- message capability

# Provides UDP syslog reception
$ModLoad imudp
$InputUDPServerRun 2500

# Provides TCP syslog reception
#$ModLoad imtcp
#$InputTCPServerRun 2048

#$InputTCPServer BindRuleset remote
#$TCPServerRun 2048





#### GLOBAL DIRECTIVES ####

# Where to place auxiliary files
$WorkDirectory /var/lib/rsyslog

# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# File syncing capability is disabled by default. This feature is usually not required,
# not useful and an extreme performance hit
#$ActionFileEnableSync on

# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf

# Turn off message reception via local log socket;
# local messages are retrieved through imjournal now.
$OmitLocalLogging on

# File to store the position in the journal
$IMJournalStateFile imjournal.state

#### RULES ####

# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.*                                                 /dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none                /var/log/messages

# The authpriv file has restricted access.
authpriv.*                                              /var/log/secure

# Log all the mail messages in one place.
mail.*                                                  -/var/log/maillog


# Log cron stuff
cron.*                                                  /var/log/cron

# Everybody gets emergency messages
*.emerg                                                 :omusrmsg:*

# Save news errors of level crit and higher in a special file.
uucp,news.crit                                          /var/log/spooler

# Save boot messages also to boot.log
local7.*                                                /var/log/boot.log

# ### begin forwarding rule ###
# The statement between the begin ... end define a SINGLE forwarding
# rule. They belong together, do NOT split them. If you create multiple
# forwarding rules, duplicate the whole block!
# Remote Logging (we use TCP for reliable delivery)
#
# An on-disk queue is created for this action. If the remote host is
# down, messages are spooled to disk and sent when it is up again.
#$ActionQueueFileName fwdRule1 # unique name prefix for spool files
#$ActionQueueMaxDiskSpace 1g   # 1gb space limit (use as much as possible)
#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
#$ActionQueueType LinkedList   # run asynchronously
#$ActionResumeRetryCount -1    # infinite retries if host is down
# ### end of the forwarding rule ###

$template RemoteHost, "/opt/splunk/var/log/syslog/%HOSTNAME%/%FROMHOST-IP%.log"

*.* ?RemoteHost
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is my rsyslog.conf file. I changed it a bit as part of my trying to get it to work, so it's not exactly the same as it is above, so feel free to tell me if I screwed it up.&lt;/P&gt;</description>
      <pubDate>Tue, 08 May 2018 08:34:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375842#M94799</guid>
      <dc:creator>leongchongyu</dc:creator>
      <dc:date>2018-05-08T08:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up Splunk monitoring of rsyslog with UDP</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375843#M94800</link>
      <description>&lt;P&gt;Took the liberty to put it in your post as code, such that it is actually readable.&lt;/P&gt;

&lt;P&gt;One issue:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$InputUDPServerRun 2500
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Should be (as you had it before, according to your question):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$UDPServerRun 2500
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Am I overlooking something or is the &lt;CODE&gt;*.* /opt/splunk/var/log/syslog/test.log&lt;/CODE&gt; part missing?&lt;/P&gt;

&lt;P&gt;You replaced this by:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$template RemoteHost, "/opt/splunk/var/log/syslog/%HOSTNAME%/%FROMHOST-IP%.log"

 *.* ?RemoteHost
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which I think should work, but keeping it simple might make troubleshooting a bit easier.&lt;/P&gt;

&lt;P&gt;But fix that UDPServerRun first and then check again.&lt;/P&gt;

&lt;P&gt;What did you find for the other checks I suggested?&lt;/P&gt;</description>
      <pubDate>Tue, 08 May 2018 14:22:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375843#M94800</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-05-08T14:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up Splunk monitoring of rsyslog with UDP</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375844#M94801</link>
      <description>&lt;P&gt;1) Firewall isn't an issue. To the best of my knowledge it is not blocking anything.&lt;BR /&gt;
2) The following are the results of running netstat -unl:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
udp        0      0 192.168.122.1:53        0.0.0.0:*
udp        0      0 0.0.0.0:67              0.0.0.0:*
udp        0      0 0.0.0.0:68              0.0.0.0:*
udp        0      0 0.0.0.0:50321           0.0.0.0:*
udp        0      0 0.0.0.0:1500            0.0.0.0:*
udp        0      0 0.0.0.0:18322           0.0.0.0:*
udp        0      0 0.0.0.0:5353            0.0.0.0:*
udp6       0      0 :::46355                :::*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;3) To the best of my knowledge rsyslog has access to the directory and there are no restrictions on it.&lt;BR /&gt;
4) Checking /var/log/messages comes up with errors for rsyslog, but none seem to pertain to the configuration I need. Some samples of messages recorded yesterday:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SELinux is preventing /usr/sbin/rsyslogd from append access on the file 127.0.0.1.log.
localhost python: SELinux is preventing /usr/sbin/rsyslogd from name_bind access on the tcp_socket port 9777
localhost python: SELinux is preventing /usr/sbin/rsyslogd from append access on the file /opt/splunk/var/log/syslog/localhost/127.0.0.1.log.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Nevertheless, if they're indicative of an issue, I can look up how to try to disable SELinux if you think it will help.&lt;/P&gt;

&lt;P&gt;Most puzzlingly, I somehow seem to have some messages recorded in /var/log/messages that's dated May 10 - that is, one day in the future!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;May 10 09:53:23 localhost rsyslogd-2212: imudp: module loaded, but no listeners defined - no input will be gathered [try &lt;A href="http://www.rsyslog.com/e/2212" target="test_blank"&gt;http://www.rsyslog.com/e/2212&lt;/A&gt; ]
May 10 11:10:47 localhost rsyslogd-2212: imudp: module loaded, but no listeners defined - no input will be gathered [try &lt;A href="http://www.rsyslog.com/e/2212" target="test_blank"&gt;http://www.rsyslog.com/e/2212&lt;/A&gt; ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Needless to say I am very confused and unsure what to make of it.&lt;/P&gt;

&lt;P&gt;Thank you so much for your extensive help - I'll try the configuration you suggested now.&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 02:52:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375844#M94801</guid>
      <dc:creator>leongchongyu</dc:creator>
      <dc:date>2018-05-09T02:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up Splunk monitoring of rsyslog with UDP</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375845#M94802</link>
      <description>&lt;P&gt;So:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;netstat says rsyslog is not listening on the port you wanted (probably because of that config mistake I pointed out alread)&lt;/LI&gt;
&lt;LI&gt;/var/log/messages is showing an error that rsyslog cannot write (if I read the message correctly) to the file you specified due to some selinux intervention.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I'm not an selinux expert, so can't really give much specific suggestions for fixing that (apart from trying it with selinux disabled temporarily). You might want to try using a separate directory for writing those logs, rather than writing them to a subdir of your splunk installation. For instance create /opt/rsyslog/logs/ owned by the user under which rsyslog runs.&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 07:08:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-up-Splunk-monitoring-of-rsyslog-with-UDP/m-p/375845#M94802</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-05-09T07:08:50Z</dc:date>
    </item>
  </channel>
</rss>

