You are not logged in.

#1 2014-07-29 00:53:25

solarwind
Member
From: Toronto
Registered: 2008-03-18
Posts: 546

How to log to your own user's systemd journal?

Hi all, how would I go about logging to syslog (systemd-journald) but for my own user? For example, a simple python program logs as follows:

import syslog
syslog.openlog('my_program')
syslog.syslog('hello, syslog')

But when I run journalctl -xn as a normal user, I don't see the log message. I only see it when I run journalctl -xn as root. As stated by the systemd documentation, journalctl only displays your own user's logs when run as a regular user, so it appears that the python program is logging to the system log instead of my own user's logs. How would I go about logging to my own user's journal?

Last edited by solarwind (2014-07-29 00:54:17)

Offline

#2 2014-07-29 09:02:03

Awebb
Member
Registered: 2010-05-06
Posts: 6,311

Re: How to log to your own user's systemd journal?

http://www.freedesktop.org/software/sys … alctl.html

All users are granted access to their private per-user journals. However, by default, only root and users who are members of the "systemd-journal" group get access to the system journal and the journals of other users.

and

--user

However, I seem to be able to read the log no matter what. I tested it on the RaspberryPi, maybe the image has some unwanted settings.

Offline

#3 2014-07-29 18:15:49

Pse
Member
Registered: 2008-03-15
Posts: 413

Re: How to log to your own user's systemd journal?

This may be a limitation of the syslog API? You'll need to check the docs. You may get better responses in the systemd mailing list or IRC channel.

Offline

#4 2014-07-30 03:13:58

solarwind
Member
From: Toronto
Registered: 2008-03-18
Posts: 546

Re: How to log to your own user's systemd journal?

Update: This wasn't working because I had the noacl option on for my root partition (where the journal is stored). Apparently the systemd journal requires ACLs for the permissions to work properly for user's journals.

Everything is working as expected now.

Last edited by solarwind (2014-07-30 03:14:46)

Offline

Board footer

Powered by FluxBB