Score:0

what happens to stdout from an executable when running as systemd service

ck flag

I'm setting up my app to run as systemd service for testing, i.e the app will change and it's currently generating output to stdout.

Is this an issue? Can I view the output in real-time if I need to? I'm not sure I'd like to log the output because if run for a long time may waste disk space. but if I do want to log output from the process how can I do that either while it's running or between systemctl stop/restart?

Thanks Ubuntu 20.04 LTS

Score:1
ck flag

I've found what I was looking for after figuring out what to search:

Systemd provides several ways to view or collect output from the executing service unit(s):

  • journalctl tool, which requires no beforehand preparation. It displays the output in several forms a page at a time, until cancelled. Output can be filtered for a specific service unit.
  • rsyslog tool must be installed and relies on making changes to the service unit file and a rsyslog.d config file. rsyslog manages the stdout and stderr of the service. Any changes to rsyslog specific service will require a service unit reload.
  • newer versions of systemd (version 240 or newer) offer a third way to redirect our service's stdout and stderr without invoking the services of a syslog deamon

This explain further and provides examples https://www.baeldung.com/linux/redirect-systemd-output-to-file

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.