[systemd-devel] SyslogIdentifier does not work for messages printed with sd_journal_print

Lennart Poettering lennart at poettering.net
Tue Jun 9 03:16:00 PDT 2015


On Tue, 02.06.15 20:31, Martin Belanger (martin.belanger at cyaninc.com) wrote:

> I'm using systemd 219 (Ubuntu 15.04).
> 
> I have three instances of a daemon running. I use SyslogIdentifier to
> give each of them a unique identifier (e.g. myproc-1, myproc-2,
> myproc-3).  I also redirect stdout/stderr to the journal using
> StandardOutput=journal and StandardError=journal.
> 
> I noticed that messages sent to the journal with printf (i.e. stdout)
> get the proper SYSLOG_IDENTIFIER.  However, messages send to the
> journal with sd_journal_print() get the default SYSLOG_IDENTIFIER
> (i.e. the process name).  I also tried sd_journal_send() and get the
> same result.
> 
> Any thoughts as to why this is happening?

SyslogIdentifier only really applies to stdout/stderr messages, not to
native journal messages, which will not carry that id at all.

The only reason the setting exists is because it's useful to set
something there because stdout/stderr doesn't carry enough information
for this, and because the same stdout/stderr stream can be shared
among multiple processes it's difficult and misleading to
automatically derive the identifier from them...

Hence: I'd really prefer fi we didn't have that option at all, we
justed added it, because it was difficult to do without...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list