[bug#77501] services: opensmtpd: Add logging to a file.

Message ID 2bd63e09a5664ecc3bb8fcee114e44db4e88bca6.1744103663.git.andreas@enge.fr
State New
Headers
Series [bug#77501] services: opensmtpd: Add logging to a file. |

Commit Message

Andreas Enge April 8, 2025, 9:14 a.m. UTC
  From: Felix Lechner <felix.lechner@lease-up.com>

* gnu/services/mail.scm (opensmtpd-shepherd-service)[start]:
Add a command line flag to not daemonize. Drop #:pid-file.
Add #:log-file.

Change-Id: I485e040d680ccb39fa62e49d2e6ea916f047972c
Signed-off-by: Andreas Enge <andreas@enge.fr>
---
Hello,

so just to be sure before I push, the patch below works for you?

Andreas


 gnu/services/mail.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)


base-commit: 43d30332bf3b4de0003578a7b5b27472b11183c7
  

Comments

Tomas Volf April 8, 2025, 6:30 p.m. UTC | #1
Andreas Enge <andreas@enge.fr> writes:

> diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
> index b9a61163d5..0d5af95986 100644
> --- a/gnu/services/mail.scm
> +++ b/gnu/services/mail.scm
> @@ -1742,8 +1742,10 @@ (define (opensmtpd-shepherd-service config)
>             (documentation "Run the OpenSMTPD daemon.")
>             (start (let ((smtpd (file-append package "/sbin/smtpd")))
>                      #~(make-forkexec-constructor
> -                       (list #$smtpd "-f" #$config-file)
> -                       #:pid-file "/var/run/smtpd.pid")))
> +                       (list #$smtpd
> +                             "-d"
> +                             "-f" #$config-file)
> +                       #:log-file "/var/log/maillog")))

Probably out of scope but would be cool to have this configurable, I
personally prefer /var/log/mail.log.  I assume you have enough on your
hands already, so will send a separate patch later.

Tomas
  
Andreas Enge April 8, 2025, 6:41 p.m. UTC | #2
Am Tue, Apr 08, 2025 at 08:30:26PM +0200 schrieb Tomas Volf:
> Probably out of scope but would be cool to have this configurable, I
> personally prefer /var/log/mail.log.  I assume you have enough on your
> hands already, so will send a separate patch later.

Sounds good, thanks! You can already start the bikeshedding discussion
about what the default value should be :)

Andreas
  
Felix Lechner April 8, 2025, 6:52 p.m. UTC | #3
Hi Andreas & Tomas,

On Tue, Apr 08 2025, Andreas Enge wrote:

> You can already start the bikeshedding

No bikeshedding needed!  Given the emerging consensus, which includes a
senior committer, I will happily prepare a patch that makes the name of
the log file configurable.

Like both of you, I also find mail.log more agreeable.

Anyway, it's easy to change that default later, but it would be harder
to change the name of the option, which is part of the API.

Is "log-file" okay?

Kind regards
Felix
  

Patch

diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index b9a61163d5..0d5af95986 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1742,8 +1742,10 @@  (define (opensmtpd-shepherd-service config)
            (documentation "Run the OpenSMTPD daemon.")
            (start (let ((smtpd (file-append package "/sbin/smtpd")))
                     #~(make-forkexec-constructor
-                       (list #$smtpd "-f" #$config-file)
-                       #:pid-file "/var/run/smtpd.pid")))
+                       (list #$smtpd
+                             "-d"
+                             "-f" #$config-file)
+                       #:log-file "/var/log/maillog")))
            (stop #~(make-kill-destructor))))))
 
 (define %opensmtpd-accounts