On Fri, 18 Jul 2014, Jason Stelzer wrote:

Thanks, the helped un-stick me.

I did this:

$template
DynFile,"/var/log/app/syslog-%SYSLOGTAG%-%$YEAR%%$MONTH%%$DAY%.log"
:syslogtag, startswith, "jps" ?DynFile
& ~


It produced syslog-jps_log[31577][133720236]:-20140718.log in the right
directory.

A couple tweaks and I can probably fuss with the stupid startswith rule to
make that dynamic too. The only thing unexpected is the [31577][133720236]
bit in the tag. I wasn't expecting that, but it's a lot closer than it was.

try programname instead of syslogtag

also, it's very useful to write some logs using the format RSYSLOG_DebugFormat as it will show you all the different properties and what values they have.

David Lang

Thanks,

--
J.




On Fri, Jul 18, 2014 at 4:11 PM, Steve Clark <[email protected]> wrote:

 On 07/18/2014 03:30 PM, Jason Stelzer wrote:

Hi,  I am using rsyslog-5.8.10 on linux.

I want to define some output logs that look something like this:

$basename-$date.log

Where $basename comes from the syslog TAG value and $date is composed with
the $now/$hour/$minute properties on the syslog message. Thus, under some
prefix like /var/log/app, different components can log to syslog to their
own log files just by providing the tag for their component name.

I am unclear as to how to get my output filename to be dynamic. I'm pretty
clear on how to use the tag to filter things to existing places with
constant names, but when I try to see how to use tag to compose an output
file rather than hard coding the path to a constant file, I find myself a
bit stuck.

Thanks in advance for any tips.


 Don't know if this will help - but this is how I set it to log remote
hosts into their own directories, with a log file by date.
...
# log every host in its own directory
$template
DynFile,"/var/log/remotes-%HOSTNAME%/syslog-%HOSTNAME%-%$YEAR%%$MONTH%%$DAY%.log"
...
# Remote Logging
$RuleSet remote
*.* -?DynFile

--
Stephen Clark
*NetWolves Managed Services, LLC.*
Director of Technology
Phone: 813-579-3200
Fax: 813-882-0209
Email: [email protected]
http://www.netwolves.com





_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to