Skip to content

syslog ident is always "daemon", even when using the "-n" option #5

@e477

Description

@e477

I'm using daemon with the -o option to redirect all output to syslog. Despite also using the -n option to explicitly set a name all syslog entries have the ident daemon. This makes the syslog impractical when using more than one daemon.

Example:

daemon -n example -o user.info /usr/bin/ls /

libslack/msg.c sets the syslog ident correctly when initializing the msg object and calling openlog. However, the result of openlog does not survive the subsequent forks. Logging still works because syslog will call openlog implicitly when required, but then the ident is undefined and at least glibc will fall back to using the executable's name which is daemon of course.

As a simple workaround I've commented out the calls to prog_err_syslog and prog_dbg_syslog (line 5158f) which delays the call to openlog till after the fork when the regular output starts. The syslog ident is correct then.

A better way would be to re-initialize syslog output after a fork, but I've not yet found out how to do this safely and thus don't have a patch ready.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions