Page 1 of 1

capturing log file name from the filter?

Posted: Tue Mar 31, 2015 10:18 am
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.

Re: capturing log file name from the filter?

Posted: Tue Mar 31, 2015 10:35 am
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.

Re: capturing log file name from the filter?

Posted: Tue Mar 31, 2015 1:36 pm
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.

Re: capturing log file name from the filter?

Posted: Tue Mar 31, 2015 5:23 pm
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.

Re: capturing log file name from the filter?

Posted: Tue Mar 31, 2015 5:29 pm
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.

Re: capturing log file name from the filter?

Posted: Wed Apr 01, 2015 3:15 pm
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.

Re: capturing log file name from the filter?

Posted: Wed Apr 01, 2015 3:19 pm
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!