i have a c program the code is
setlogmask (LOG_UPTO (LOG_NOTICE));
openlog ("thelog", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
syslog (LOG_NOTICE, "thelog : started by User %d", getuid ());
syslog (LOG_INFO, "thelog: an info is logging");
closelog();
the code is working properly BUT the issue is the log is being logged to the file /var/log/messages , i have /etc/rsyslog.conf no and syslog.conf
I want the logs to be logged to a new file /var/log/thelog.log file
how to fix this issue .
If you want LOCAL1 to be logged to a separate file you
kill -HUP
. Configuration
Add a specific line for local1, like this one
local1.* -/var/log/thelog.log
Before
*.*;mail.none;news.none -/var/log/messages
and remove local1 from the configuration for local?.*
local0.* -/var/log/localmessages
local2,local3.* -/var/log/localmessages
Once the configuration file is ready
kill -HUP <pid-of-syslogd>