• This forum has a zero tolerance policy regarding spam. If you register here to publish advertising, your user account will be deleted without further questions.

(erledigt) logrotate: globale config um mit compress zu verschlüsseln

GwenDragon

Registered User
Ich versuche per compress logs zu verschlüsseln.
Leider klappt das nicht immer, manche sind nicht verschlüsselt, obwohl in deren config compress drin steht.
Der relevante Schnipsel:
Code:
compresscmd /usr/bin/gpg
compressoptions --always-trust --encrypt --recipient your_email@domain.com
compressext .gpg

/etc/logrotate.conf
Code:
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
#dateext

# uncomment this if you want your log files compressed
#compress
# ---- encrypt saved logs
shred
compress
compresscmd /usr/bin/gpg
compressoptions -e -r sv123456@example.com
compressext .gpg
# ---

# packages drop log rotation information into this directory
include /etc/logrotate.d

# system-specific logs may be also be configured here.

Lasse ich die config für compress weg, dann geht es und die Logs sind rotiert und gzipped.
Irgendeine Idee woran das liegt? Timeout? Zu große Logdateien?

Logrotate ist Version 3.14.0
 
Last edited:
Ein logrotate -d hat nichts konkretes angezeigt wo es haken könnte. Lief auch früher schon bei Tests durch. Auch ein forcierter Testablauf mit -f klappte immer problemlos.
Ich weiß auch nicht was der Ubuntu-20-VServer hat, jetzt läuft es mal wieder.

Ich melde mich wieder, wenn es mal nicht mehr geht.
 
Last edited:
Du kannst als compresscmd einen Shell-Script-Wrapper verwenden, indem Du alle Aufrufe mit Parametern protokollierst und auch die Fehler/Ausgaben.
Code:
#!/bin/bash

mylog() {
     echo "$(date) : $*" >>/tmp/compress.log
}
main() {
    mylog "call: $0 $*"
     # encrypt call here ...
    mylog "return: $?"
}   

while read line ; do
     mylog "output: $line"
done < <(main 2>&1)
 
Last edited:
Danke, @greystone Das Ganze per Redirect in eine Logdatei mit zu schneiden, dabei auch noch Systemressourcen zu loggen, wäre das Angebrachte, logrotate läuft ja morgens.
 
Ich habe mich nicht mehr gemeldet, weil zu Helfenden der Server neu aufgesetzt wurde und das compress nun korrekt läuft.
 
Back
Top