opc0de opc0de - 1 year ago 114
C Question

Where does linux store my syslog?

I wrote a simple test application to log something in a log file. I am using linux mint and after the application executes I try to view the log using this command:

tail -n 100 /var/log/messages

but the file messages does not exist neither tested or something. Below you can find my code. Maybe I am doing something wrong, the file isn't stored there or I need to enable logging in linux mint.

#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>

void init_log()
openlog("testd",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);

int main(void) {

printf("Session started!");
syslog(LOG_NOTICE, "Session started!!");


Answer Source

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

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download