capturing log file name from the filter?

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
Locked
zakhemj
Posts: 9
Joined: Tue Dec 02, 2014 4:12 pm

capturing log file name from the filter?

Post by zakhemj »

Hello

Is there a way in NLS to capture and display the original file name (and path) of the log file being collected? I am using the default rsyslog collector and I was wondering if I have to adjust the input or if I can modify the filter specific to the program.

Thanks.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: capturing log file name from the filter?

Post by tmcdonald »

I don't believe remote (r)syslog entries contain the file name:

http://stackoverflow.com/questions/9209 ... age-format

So unless the message contains the file name, I am not aware of a way to retrieve this.
Former Nagios employee
zakhemj
Posts: 9
Joined: Tue Dec 02, 2014 4:12 pm

Re: capturing log file name from the filter?

Post by zakhemj »

Hi. Thanks for the reply. I thought I could get it from the rsyslog.d/conf file itself. It has the InputFileName (as well as InputFileTage) in the configuration.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: capturing log file name from the filter?

Post by jdalrymple »

There is no log file associated with a remote log stream. In our human brains we create an association, but there really isn't one. You could potentially send ALL logs to a remote NLS without ever writing a related file. Does that make sense?

There is no correlation between the files being written on the host and the stream being sent to NLS.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: capturing log file name from the filter?

Post by jolson »

In addition to what jdalrymple said, can you please explain the reason why you're looking for the file name/path? Perhaps we could help you out - I don't think that rsyslod has that built-in functionality without a massive amount of tinkering.
Twits Blog
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.
zakhemj
Posts: 9
Joined: Tue Dec 02, 2014 4:12 pm

Re: capturing log file name from the filter?

Post by zakhemj »

Thanks for the replies. jdalrymple, what you're saying makes sense. jolson, I understand that rsyslog would not support this without modification.

To answer jolson's question - I would like the name and path of my log files because we man tomcat applications that log separately, in separate sandboxes, that log very similar data. I suspect the way to address this (if we really wanted to have the name and path) is to add that information to the log itself.

Thanks again to both of you.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: capturing log file name from the filter?

Post by jolson »

That would definitely be the easiest way to approach this. If you need help after you add the 'path' to the log files, we can help you construct a filter to retrieve that information. Let us know - thanks!
Twits Blog
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.
Locked