🔊 Redirect curl output to debug log

curl only logs its own errors to stderr with the given options (--silent
--show-error).  Requests answered by the remote webserver, regardless of
HTTP status code, go to stdout.  So in case of an unsuccesful update
with some error condition we could not see that before.  Redirect those
to debug log, because it's still quite noisy otherwise.

This adds 288 log messages per day and service to the debug log,
accounting to max. 30k per day and service, and thus should not hurt.

desec log output is only the word "good" in case of success.

dd24 full output would be this, and is thus reduced to the relevant
lines merged in one line:

    [RESPONSE]
    code = 200
    description = Command completed successfully
    runtime = 0.067
    queuetime = 0
    EOF

Sample journald entry:

    Feb 27 12:48:15 pottwal dd24[519651]: code = 200,description = Command completed successfully
This commit is contained in:
Alexander Dahl 2025-02-27 13:57:29 +01:00
parent 58e27dec10
commit 338dfc7410
2 changed files with 2 additions and 2 deletions
roles
dd24_dyndns_cron/templates
desec_dyndns_cron/templates

View file

@ -3,4 +3,4 @@
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
*/5 * * * * root curl --silent --show-error "https://dynamicdns.key-systems.net/update.php?hostname={{dyndns_domain}}&password={{dyndns_password}}&ip={{dyndns_ip}}" > /dev/null 2> >(/usr/bin/logger -p user.error -t dd24)
*/5 * * * * root curl --silent --show-error "https://dynamicdns.key-systems.net/update.php?hostname={{dyndns_domain}}&password={{dyndns_password}}&ip={{dyndns_ip}}" > >(grep 'code\|description' | paste -d',' - - | logger -p user.debug -t dd24) 2> >(/usr/bin/logger -p user.error -t dd24)

View file

@ -3,4 +3,4 @@
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
*/5 * * * * root curl --silent --show-error --user {{ dyndns_domain }}:{{ dyndns_token }} "https://update.dedyn.io/" > /dev/null 2> >(/usr/bin/logger -p user.error -t desec)
*/5 * * * * root curl --silent --show-error --user {{ dyndns_domain }}:{{ dyndns_token }} "https://update.dedyn.io/" > >(logger -p user.debug -t desec) 2> >(/usr/bin/logger -p user.error -t desec)