I am trying to setup logging for an app with a new custom conf file under /etc/rsyslog.d as below & name the file as 30-custom.conf

$template DailyPerHostLogs, "/var/log/rsyslog/<new_folder>/%$YEAR%%$MONTH%%$DAY%-%HOSTNAME%.log
app* -?DailyPerHostLogs
& stop

I did restarted rsyslog.. after above change but some how whatever logging is being written to%$YEAR%%$MONTH%%$DAY%-%HOSTNAME%.log file under /var/log/rsyslog/<new_folder> / is also being written to /var/log/syslog.

Is there a way I can avoid it ..not to write to default /var/log/syslog? Did i miss any step here?

OS: Ubuntu 14.04.5

  • read man syslog.conf, and look at /etc/syslog.conf. What Facility and Priority are you using in your logging calls? – waltinator May 16 '17 at 23:22
  • Sorry for delay response. I didn't changed anything in /etc/syslog.conf. Do we need to change anything there ? what i am trying to achieve is execute my custom.conf before it executes the default.conf file , thought it happens custom.conf logging comes to syslog which i don't want. – Drams May 23 '17 at 19:31
  • I repeat, "What Facility and Priority are you using in your logging calls?" The Facility and Priority govern how the syslog rules handle the request. – waltinator May 23 '17 at 23:41
  • I assume you are asking below info ..correct me if i am wrong as i am newbie auth,authpriv.* /var/log/auth.log *.*;auth,authpriv.none -/var/log/syslog #cron.* /var/log/cron.log #daemon.* -/var/log/daemon.log kern.* -/var/log/kern.log #lpr.* -/var/log/lpr.log mail.* -/var/log/mail.log #user.* -/var/log/user.log mail.err /var/log/mail.err – Drams May 24 '17 at 18:06
  • No, I'm asking how your app specifies the Facility and Priority. Show us the "put a message into syslog" call that your app uses. – waltinator May 24 '17 at 20:32

actually I think, your 50-default.conf file is read before this file, which causes your logs to be written in the syslog file.

Specify this in the 50-default.conf file, before the line,

*.*;auth,authpriv.none          /var/log/syslog

That should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.