How to name dir or logfile with the msg send time ?

This is the place for you, if you got rsyslog up and running but wonder how to make it do what you want.

Moderator: rgerhards

How to name dir or logfile with the msg send time ?

Postby flytod » Sat Jun 27, 2009 5:17 pm

syslon-ng can use S_YEAR,S_MONTH,S_DAY etc to define log file or directory name.
example:
file("/var/log/syslog-ng/$S_YEAR-$S_MONTH-$S_DAY/$HOST/alarm")
flytod
New
 
Posts: 2
Joined: Sat Jun 27, 2009 5:09 pm

Professional Services Information

  • Custom written rsyslog.conf?
  • Maintenance Contract?
  • Installation support?

Re: How to name dir or logfile with the msg send time ?

Postby rgerhards » Mon Jun 29, 2009 11:00 am

you should look into the property replacer and the dynafile doc. It is along these lines

$template filename "/path/to/%YEAR%/file.log"
*.* ?filename
User avatar
rgerhards
Site Admin
 
Posts: 2642
Joined: Thu Feb 13, 2003 11:57 am

Re: How to name dir or logfile with the msg send time ?

Postby flytod » Mon Jun 29, 2009 4:28 pm

but syslog-ng can user the time of send host or the time of receive host to name logfile.

it can use S_YEAR, S_MONTH, S_DAY etc or R_YEAR, R_MNTH, R_DAY etc ,

some time, we have many servers, the time have a diffent about 1 or 2 sec.
flytod
New
 
Posts: 2
Joined: Sat Jun 27, 2009 5:09 pm

Re: How to name dir or logfile with the msg send time ?

Postby rgerhards » Mon Jun 29, 2009 6:20 pm

then you need to extract the timestamps form the respective fields via the property replacer.
User avatar
rgerhards
Site Admin
 
Posts: 2642
Joined: Thu Feb 13, 2003 11:57 am

Google Ads



Return to Configuration

Who is online

Users browsing this forum: No registered users and 0 guests

cron