Where does linux store my syslog? Where does linux store my syslog? linux linux

Where does linux store my syslog?


On my Ubuntu machine, I can see the output at /var/log/syslog.

On a RHEL/CentOS machine, the output is found in /var/log/messages.

This is controlled by the rsyslog service, so if this is disabled for some reason you may need to start it with systemctl start rsyslog.

As noted by others, your syslog() output would be logged by the /var/log/syslog file.
You can see system, user, and other logs at /var/log.

For more details: here's an interesting link.


In addition to the accepted answer, it is useful to know the following ...

Each of those functions should have manual pages associated with them.

If you run man -k syslog (a keyword search of man pages) you will get a list of man pages that refer to, or are about syslog

$ man -k sysloglogger (1)           - a shell command interface to the syslog(3) system l...rsyslog.conf (5)     - rsyslogd(8) configuration filersyslogd (8)         - reliable and extended syslogdsyslog (2)           - read and/or clear kernel message ring buffer; set c...syslog (3)           - send messages to the system loggervsyslog (3)          - send messages to the system logger

You need to understand the manual sections in order to delve further.

Here's an excerpt from the man page for man, that explains man page sections :

The table below shows the section numbers of the manual followed  bythe types of pages they contain.   1   Executable programs or shell commands   2   System calls (functions provided by the kernel)   3   Library calls (functions within program libraries)   4   Special files (usually found in /dev)   5   File formats and conventions eg /etc/passwd   6   Games   7   Miscellaneous  (including  macro  packages and convenā€       tions), e.g. man(7), groff(7)   8   System administration commands (usually only for root)   9   Kernel routines [Non standard]

To read the above run

$man man 

So, if you run man 3 syslog you get a full manual page for the syslog function that you called in your code.

SYSLOG(3)                Linux Programmer's Manual                SYSLOG(3)NAME   closelog,  openlog,  syslog,  vsyslog  - send messages to the system   loggerSYNOPSIS   #include <syslog.h>   void openlog(const char *ident, int option, int facility);   void syslog(int priority, const char *format, ...);   void closelog(void);   #include <stdarg.h>   void vsyslog(int priority, const char *format, va_list ap);

Not a direct answer but hopefully you will find this useful.


Default log location (rhel) are

General messages:

/var/log/messages

Authentication messages:

/var/log/secure

Mail events:

/var/log/maillog

Check your /etc/syslog.conf or /etc/syslog-ng.conf (it depends on which of syslog facility you have installed)

Example:

$ cat /etc/syslog.conf# Log anything (except mail) of level info or higher.# Don't log private authentication messages!*.info;mail.none;authpriv.none         /var/log/messages# The authpriv file has restricted access.authpriv.*                             /var/log/secure# Log all the mail messages in one place.mail.*                                 /var/log/maillog#For a start, use this simplified approach.*.*                                     /var/log/messages