1

I have a dotnet core application that is executed by a systemctl service. In normal operation it will always execute in this context. However the application may also be executed manually by the user so they can see debug statements sent to the console. I have observed that the console output is also sent to daemon.log and syslog. The application is monitoring external events and may generate a lot of messages and in a couple of instances it has filled up the SD card. I have tried to disable the output by adding the following to the service unit file:

 [Service]
 StandardError=null  
 StandardOutput=null

This seems to prevent the application from writing to the daemon and syslog logs. My question is - is this advisable and are there other places I need to worry about. I am a bit of a linux noob so I am still picking up these pitfalls.

Long term I will need to update the application's internal logging but is this approach make sense overall?

0

Nobody can answer this properly other than to say that anything sent to stdout or stderr will be discarded. What the application does besides that we don't know, but most likely all the output you are finding in the logs was captured from stdout/stdin.

If you aren't familiar with the stdout/stderr abstractions, this is not just a linux invention but derives from Unix and C, and most languages derived from and/or implemented in C, which is to say, most common general purpose programming languages: https://en.wikipedia.org/wiki/Standard_streams

With regard to how they are dealt with by systemd, you can find directives indexed in man systemd.directives1; these (StandardOutput etc) are in man systemd.exec. The short story from that is the default is journal, hence all the captured output.

So, if the application isn't itself explicitly using the system logger, then discarding stdout/stderr with null should do it.


  1. The default man page viewer, less, has a regex search accessible via / (a common nix tool hotkey). Eg., within man systemd.directives try /Standard.
  • The application is just using Console.Writeline which is sent to the the standard output stream, so based on this I should be good. Thanks for the info. Marking as answer. – Fuzzytrooper Aug 5 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.