Community
cancel
Showing results for 
Search instead for 
Did you mean: 
AAlex19
Novice
2,361 Views

Systemd journal as Output not working

normaly its default that a sysdaemon outputs err and out to journal at default.

details see link:

https://www.freedesktop.org/software/systemd/man/systemd.exec.html# StandardOutput= https://www.freedesktop.org/software/systemd/man/systemd.exec.html# StandardOutput=

but even when u define

StandardOutput=journal

it will refuse to work.

I set it to syslog and watched it via

journalctl -f

but thats pretty anoying if u ask me. I think is something related to the systemd sockets and configs.

checkted /etc/system/journal.conf and system.conf so far...but even forcing it to use journal did not work.

Any hints?

8 Replies
idata
Community Manager
109 Views

Hi,

 

 

I don't quite understand what you're trying to achieve or are expecting to see with these commands. I ran journalctl –f and didn't see any unusual behavior. Can you explain in more detail what behavior you describe as annoying, is something not working as it should?

 

 

-Sergio

 

AAlex19
Novice
109 Views

when u define ur service as systemd service, u get at default the journal as output

so when u do

journalctl -fu daemon-name

u will get the stdout and stderr output to journal for a program running as daemon called daemon-name

so when u do now console.log('hello') in this i.e. nodejs daemon programm called daemon-name it should write hello and some more to the journal. but it does NOT.

Its working for all other descriptors but not journal.

its getting lost, only way to preserve it is to redirect is to systemlog, konsole, or custom log file. i.e.

/lib/systemd/system/daemon-name.service

...

StandardOutput=syslog+console

...

idata
Community Manager
109 Views

Hi,

 

 

Thanks for the explanation. However, I'm not sure if you already were able to find a solution by making the change with StandardOutput=syslog+console, or if you still need help with it. Do you need to make these changes permanent?

 

 

Let us know if there is anything else we can help you with.

 

 

-Sergio

 

AAlex19
Novice
109 Views

offcourse i want a solution, i dont want to swarm syslog.

Its a bug and it was working in older image.

stdout and stderr should, like intended by systemd developers, go to journal at default not nowhere...dont u think?i suspect there is something wrong with the systemd config/socket.

What i do is a workaround, a hack, not a solution for productivity environment.

Would be nice if u could fix this bug, in future images at least

idata
Community Manager
109 Views

Hi Booker_B,

 

 

We'll pass your request and workaround to the proper team. We just need to know in which image/images this was working as expected and in which image are you testing now that has the bug.

 

 

Thank you

 

-Sergio

 

AAlex19
Novice
109 Views

current image ist https://software.intel.com/edison-image/latest https://software.intel.com/edison-image/latest

thats iot-devkit-prof-dev-image-edison-20160606

 

i used a custom before, made with yocto:

 

edison-image-edison-20141118085659.rootfs.ext4

 

 

idata
Community Manager
109 Views

Thank you for the information. We've passed this request to the proper team. Hopefully there'll be a fix for this bug soon.

 

 

-Sergio

 

idata
Community Manager
109 Views

Hi,

 

 

After doing some research and running some tests we were able to make some progress. We can verify that the service is writing to the journal. We were also able to direct the stdout to the journal by adding StandardOutput=journal and sys.stdout.flush() on the python script. This procedure might be beneficial for other users but writing stdout from a user program is not practical since it will make the journal size big. To monitor the journal use journalctl –f.

 

 

Blink.service:

 

[Unit]

 

Description=Blink!

 

[Service]

 

ExecStart=/usr/bin/python /home/root/blink.py

 

StandardOutput=journal

 

[Install]

 

WantedBy=multi-user.target

 

 

Blink.py:

 

import mraa

 

import time

 

import sys

 

x = mraa.Gpio(13)

 

x.dir(mraa.DIR_OUT)

 

while True:

 

x.write(1)

 

time.sleep(1)

 

x.write(0)

 

time.sleep(1)

 

print("Blink Cycle")

 

sys.stdout.flush()

 

 

We hope you find this useful.

 

 

-Sergio