0

I want to log everything to syslog in my application. I will be logging mostly at two levels. Info and debug. Debug messages I do not want end users to be able to see or access. As such these messages will be caught with the syslog.conf to a special folder.

My question is can I log other messages to console and to the messages file? My though was the following but this does not work as I expected.

#  /etc/syslog.conf     Configuration file for busybox's syslogd utility

*.debug     /var/log/debug

*.info      /var/log/info
*.info      /dev/consol
1
  • Also, double check that you don't have the typo /dev/consol as opposed to /dev/console in your configuration file. Commented Mar 29, 2022 at 22:52

1 Answer 1

-1

As per man 3 syslog make sure the "priority" value is set correctly when calling syslog().

A few useful snippets from the man page:

The priority argument is formed by ORing together a facility value and a level value (described below). If no facility value is ORed into priority, then the default value set by openlog() is used, or, if there was no preceding openlog() call, a default of LOG_USER is employed.

and

Values for facility: The facility argument is used to specify what type of program is logging the message. This lets the configuration file specify that messages from different facilities will be handled differently.

  • LOG_AUTH security/authorization messages
  • LOG_AUTHPRIV security/authorization messages (private)
  • LOG_CRON clock daemon (cron and at)=
  • LOG_DAEMON system daemons without separate facility value
  • LOG_FTP ftp daemon
  • LOG_KERN kernel messages (these can't be generated from user processes)
  • LOG_LOCAL0 through LOG_LOCAL7 reserved for local use
  • LOG_LPR line printer subsystem
  • LOG_MAIL mail subsystem
  • LOG_NEWS USENET news subsystem
  • LOG_SYSLOG messages generated internally by syslogd(8)
  • LOG_USER (default) generic user-level messages
  • LOG_UUCP UUCP subsystem

Values for level: This determines the importance of the message. The levels are, in order of decreasing importance:

  • LOG_EMERG system is unusable
  • LOG_ALERT action must be taken immediately
  • LOG_CRIT critical conditions
  • LOG_ERR error conditions
  • LOG_WARNING warning conditions
  • LOG_NOTICE normal, but significant, condition
  • LOG_INFO informational message
  • LOG_DEBUG debug-level message

The function setlogmask(3) can be used to restrict logging to specified levels only.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .