5

Is it possible to have one application simultaneously write to multiple syslog facilities?

I have an application, written in C/C++, that I would like to write some messages to local0 and other messages to local1. I do not want the messages for local0 to appear in local1 or vice versa.

jschmier
  • 15,458
  • 6
  • 54
  • 72

2 Answers2

14

Looking at the man page for syslog, I see the example:

syslog(LOG_INFO|LOG_LOCAL2, "foobar error: %m");

Does

syslog(LOG_INFO|LOG_LOCAL0, "message for local0");
syslog(LOG_INFO|LOG_LOCAL1, "message for local1");

work?

Aidan Cully
  • 5,457
  • 24
  • 27
  • I can't believe I didn't check the man pages before posting my question (palm meets forhead). After reviewing the man pages myself, I do believe that this will work for what I need to accomplish since the priority argument is formed by ORing the facility and the level values. Thanks. – jschmier Jan 09 '10 at 18:42
0

You can't do it in a single call. You'll have to make a call for each facility.

Joe
  • 41,484
  • 20
  • 104
  • 125