[GH-ISSUE #21] Option to disable logfile #5

Closed
opened 2026-02-26 18:32:55 +03:00 by kerem · 3 comments
Owner

Originally created by @jantari on GitHub (Mar 17, 2021).
Original GitHub issue: https://github.com/decke/smtprelay/issues/21

Hi, is it possible to disable the manual logfile the program writes?

I would run this as a systemd service, and in that case systemd-journald automatically captures the STDOUT of the program and keeps it in a log, with control over rotation and standardized commands to get the logs.

I tried commenting out the config line:

;logfile = /var/log/smtprelay.log

but it just defaulted to the same path again. I'm trying to NOT have this logfile at all, because it would just take up space and when I try to start my systemd service I get:

● smtprelay.service - Simple Golang SMTP relay/proxy server
     Loaded: loaded (/etc/systemd/system/smtprelay.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2021-03-17 14:59:20 CET; 6s ago
    Process: 34965 ExecStart=/usr/local/bin/smtprelay --config /etc/smtprelay/config.ini (code=exited, status=1/FAILURE)
   Main PID: 34965 (code=exited, status=1/FAILURE)

Mar 17 14:59:20 myserver systemd[1]: Started Simple Golang SMTP relay/proxy server.
Mar 17 14:59:20 myserver smtprelay[34965]: 2021/03/17 14:59:20 Error opening logfile: open /var/log/smtprelay.log: permission denied
Mar 17 14:59:20 myserver systemd[1]: smtprelay.service: Main process exited, code=exited, status=1/FAILURE
Mar 17 14:59:20 myserver systemd[1]: smtprelay.service: Failed with result 'exit-code'.

because obviously the system account the service runs as doesn't have any unneeded permissions in that directory (/var/log).

Originally created by @jantari on GitHub (Mar 17, 2021). Original GitHub issue: https://github.com/decke/smtprelay/issues/21 Hi, is it possible to disable the manual logfile the program writes? I would run this as a systemd service, and in that case systemd-journald automatically captures the STDOUT of the program and keeps it in a log, with control over rotation and standardized commands to get the logs. I tried commenting out the config line: ;logfile = /var/log/smtprelay.log but it just defaulted to the same path again. I'm trying to NOT have this logfile at all, because it would just take up space and when I try to start my systemd service I get: ● smtprelay.service - Simple Golang SMTP relay/proxy server Loaded: loaded (/etc/systemd/system/smtprelay.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2021-03-17 14:59:20 CET; 6s ago Process: 34965 ExecStart=/usr/local/bin/smtprelay --config /etc/smtprelay/config.ini (code=exited, status=1/FAILURE) Main PID: 34965 (code=exited, status=1/FAILURE) Mar 17 14:59:20 myserver systemd[1]: Started Simple Golang SMTP relay/proxy server. Mar 17 14:59:20 myserver smtprelay[34965]: 2021/03/17 14:59:20 Error opening logfile: open /var/log/smtprelay.log: permission denied Mar 17 14:59:20 myserver systemd[1]: smtprelay.service: Main process exited, code=exited, status=1/FAILURE Mar 17 14:59:20 myserver systemd[1]: smtprelay.service: Failed with result 'exit-code'. because obviously the system account the service runs as doesn't have any unneeded permissions in that directory (`/var/log`).
kerem closed this issue 2026-02-26 18:32:55 +03:00
Author
Owner

@JonathonReinhart commented on GitHub (Mar 17, 2021):

Hi @jantari. Am I correct in assuming you're running the latest-released v1.5.0?

We just recently merged #15 which, among other things, changes the default log file to STDERR. This change was made primarily with running as a systemd service in mind.

So you can either wait for the next release (I'm not sure what that timeline looks like; @decke will have to fill-in here), or you can pull the source and build from master yourself.

I'm going to close this issue because I think it is already resolved, but please feel free to comment if there's anything else! Thanks!

<!-- gh-comment-id:801118840 --> @JonathonReinhart commented on GitHub (Mar 17, 2021): Hi @jantari. Am I correct in assuming you're running the latest-released [v1.5.0](https://github.com/decke/smtprelay/releases/tag/v1.5.0)? We just recently merged #15 which, among other things, changes the default log file to STDERR. This change was made primarily with running as a systemd service in mind. So you can either wait for the next release (I'm not sure what that timeline looks like; @decke will have to fill-in here), or you can pull the source and build from `master` yourself. I'm going to close this issue because I think it is already resolved, but please feel free to comment if there's anything else! Thanks!
Author
Owner

@jantari commented on GitHub (Mar 17, 2021):

Thanks for the quick response, yes I am using 1.5.0

I'll wait for the next release and try logging to /dev/null or something in the meantime as a workaround.

<!-- gh-comment-id:801122533 --> @jantari commented on GitHub (Mar 17, 2021): Thanks for the quick response, yes I am using 1.5.0 I'll wait for the next release and try logging to /dev/null or something in the meantime as a workaround.
Author
Owner

@decke commented on GitHub (Mar 17, 2021):

I planned to have a 1.6.0 release within the next few weeks but would like to discuss and merge the open PRs before that.

<!-- gh-comment-id:801229839 --> @decke commented on GitHub (Mar 17, 2021): I planned to have a 1.6.0 release within the next few weeks but would like to discuss and merge the open PRs before that.
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/smtprelay#5
No description provided.