Wang Tuma
Wang Tuma

Reputation: 1075

using syslog to log to my own log file?

I'm writing a program A and use syslog() to do logging. Instead of logging to default /var/log/messages or other default system log files, can I specify my own log file and use syslog() to log to it? (I really want to make use of syslogd's facility to manage this log file.) What configurations is needed in /etc/syslog.conf? Thanks.

Upvotes: 3

Views: 2143

Answers (1)

user3303729
user3303729

Reputation: 284

You'll need to pick a logging facility, presumably one of LOG_LOCAL0 through LOG_LOCAL7 (though it's unlikely anyone will notice LOG_NEWS or LOG_UUCP being overwritten), and then create a line in syslog.conf in the form of:

localn.*     my_logfile

Upvotes: 1

Related Questions