I want to just add what would be needed to also send the log to NLS. Can I do this within one file? I know I can create another to send the logs to NLS and order them properly but if can be accomplished by combining them, I think it would be better. Any help/advice greatly appreciated.
Can I do this within one file? I know I can create another to send the logs to NLS and order them properly but if can be accomplished by combining them, I think it would be better.
Is that the full config contained in rsyslog.d? If you have a more full version, I'd like to see it.
I don't see why you wouldn't be able to do this in one file. You can use the following as a template for adding a file to be sent to NLS:
[root@localhost ~]# cat /etc/rsyslog.d/90-nagioslogserver_root_.mysql_history.conf
$ModLoad imfile
$InputFilePollInterval 10
$PrivDropToGroup adm
$WorkDirectory /var/lib/rsyslog
# Input for sometag
$InputFileName /root/.mysql_history
$InputFileTag sometag:
$InputFileStateFile nls-state-root_.mysql_history # Must be unique for each file being polled
# Uncomment the folowing line to override the default severity for messages
# from this file.
#$InputFileSeverity info
$InputFilePersistStateInterval 20000
$InputRunFileMonitor
# Forward to Nagios Log Server and then discard, otherwise these messages
# will end up in the syslog file (/var/log/messages) unless there are other
# overriding rules.
if $programname == 'sometag' then @@192.168.x.x:5544
if $programname == 'sometag' then ~
TwitsBlog Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
I have setup similar to what you posted as a template for me (Thanks) on the system to send the entries from the jupiter.log file to NLS. So I have two files, the 85-jupiter.conf then a 90-jupiter.conf. So the first on put the log entries in
/var/opt/lrms/log/jupiter.log
and I then would have the 90-jupiter.conf look at /var/opt/lrms/log/jupiter.log and send them to the NLS. The merge of the two is the desired outcome.
Could you provide a few example logs? I would like to get this working on my end - once I find a suitable configuration I can send it through an additional forum post. But first, I'd like some log lines to work with.
Thanks Mitch,
Jesse
TwitsBlog Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
I've been testing this for awhile, and I have a question for you.
Is there a particular reason that you're applying the following template: $template JupiterFormat,"%TIMESTAMP:::date-rfc3339% %msg:::sp-if-no-1st-sp% %msg:::drop-last-lf%\n" to your logs before shipping them via rsyslog? I ask because it would likely be easier to ship logs from /var/opt/lrms/log/jupiter.log matching the line 'jupiter' and modify them on the logstash-side of things. The syntax for Logstash is a little less complicated, and if you needed to make changes the configuration would be more central.
I almost have this working, but I'd like to know the answer to the above before I post my solution. Thanks!
TwitsBlog Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
That is an install by the vendor for the core development team. They want the detailed timestamp. Is there a way in which the msg would be sent to NLS then set the template for the file to be written to the local log?
$ModLoad imfile
$InputFilePollInterval 1
$PrivDropToGroup adm
$WorkDirectory /var/lib/rsyslog
# Input for sometag
$InputFileName /root/jupiter.log
$InputFileTag jupiter:
$InputFileStateFile nls-state-root.jupiter # Must be unique for each file being polled
# Uncomment the folowing line to override the default severity for messages
# from this file.
#$InputFileSeverity info
$InputFilePersistStateInterval 1
$InputRunFileMonitor
# Add timestamp
$template JupiterFormat,"%TIMESTAMP:::date-rfc3339% %msg:::sp-if-no-1st-sp% %msg:::drop-last-lf%\n"
# Forward to Nagios Log Server and then discard, otherwise these messages
# will end up in the syslog file (/var/log/messages) unless there are other
# overriding rules.
if $programname == 'jupiter' then @@192.168.4.194:5544;JupiterFormat
if $programname == 'jupiter' then /var/log/jupiter.log;JupiterFormat
if $programname == 'jupiter' then ~