successgo / blog

This is Success Go's blog.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Linux] syslog

successgo opened this issue · comments

The manual: man syslog.

Minimal demo

#include <syslog.h>

int
main(void)
{
    openlog("gdcapp", LOG_PID, LOG_USER);
    syslog(LOG_INFO, "%s", "This is an info message.");
    return 0;
}

Open a terminal window and issue below command:

sudo tail -f /var/log/syslog

then compile the program and execute it.

Know more

From wiki:

https://en.wikipedia.org/wiki/Syslog

https://en.wikipedia.org/wiki/Rsyslog

From rfc histories:

https://tools.ietf.org/html/rfc3164

https://tools.ietf.org/html/rfc5424