Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: Universal SyslogIdentifier Option in Service Files #13566

Closed
archuserr opened this issue Sep 16, 2019 · 3 comments
Closed

RFE: Universal SyslogIdentifier Option in Service Files #13566

archuserr opened this issue Sep 16, 2019 · 3 comments

Comments

@archuserr
Copy link

I have several python programs that start from .service or .timer files. My problem is that in the journal, all of them have SYSLOG_IDENTIFIER=python3. Sometimes It's difficult/impossible to determine which program generated the message.

I made the same mistake as bug #8687 thinking SyslogIdentifier would solve this. Can we either expand the functionality of SyslogIdentifier or add a new option to set SYSLOG_IDENTIFIER for all journal entries?

An alternative is using -o with-unit, but I also need short-precise and I can't use both at the same time. Also with with-unit, long file names don't leave much space for the message.

My current/temporary solution is adding the program name to the message python sends to the journal, but that uses valuable space. My screen isn't wide enough.

@archuserr archuserr changed the title Universal SyslogIdentifier Option in Service Files RFE: Universal SyslogIdentifier Option in Service Files Sep 16, 2019
@archuserr
Copy link
Author

I tried using prctl(PR_SET_NAME, ...) to change the process name. ps and top use the new name, but the journal does not.

@poettering
Copy link
Member

How does your program log? Via stderr or via syslog() or an equivalent call?

@archuserr
Copy link
Author

I solved my problem. I installed the python-systemd module. It lets me set the process name:

systemd.journal.send('my message', SYSLOG_IDENTIFIER='myProgram', PRIORITY=systemd.journal.LOG_INFO)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants