Stimmt, der Befehl dazu heißt tar aka Tape Archive, ein Relikt aus der
Computer-Steinzeit :-)
> Vorschlag:
> attr global archivecmd "gzip %; mv %.gz /var/log/archivedir"
> (ungetestet)
Commandref.html :
Attributes
archivecmd / archivedir / nrarchive
When a new FileLog file is opened, the FileLog archiver wil be called.
This happens only, if the name of the logfile has changed (due to
time-specific wildcards, see the FileLog section), and there is a new entry
to be written into the file.
If the attribute archivecmd is specified, then it will be started as a
shell command (no enclosing " is needed), and each % in the command will be
replaced with the name of the old logfile.
If this attribute is not set, but nrarchive and/or archivecmd are set,
then nrarchive logfiles are kept while older ones are moved to archivedir
(or deleted if archivedir is not set).
Ich habe mal versucht das umzusetzen, dabei fiel mir auf, das Ändern der
Logdateinamen ist lästig: Bei meiner Installation gibt es inzwischen 17
Logfiles, ich habe sie manuell von /log/xyz-%Y.log in /log/xyz-%Y-%m-%d.log
umbenannt. Es wäre schön, wenn das zentral für alle Logdateien ginge. Das
Gleiche gilt für das Attribut archivedir und archivecmd.
Wenn man, wie oben angegeben attr global archivecmd "gzip %; mv %.gz
/var/log/archivedir" setzt, brauchen laut commandref keine Gänsefüßchen
gesetzt zu werden. Das Auswerten von % an der Stelle verhindert wirksam das
Einfügen eines Zeitstempels.
Ich versuche derzeit mein Glück mit notify und at, merkwürdig ist folgendes:
define LogRotate at *14:59:10 "/bin/tar -cO -C /var/InternerSpeicher/fhem
log | /bin/gzip > /var/InternerSpeicher/fhemlog-$(date
\+%Y%m%d%H%M).tar.gz;; rm -R /var/InternerSpeicher/fhem/log/*.log"
define LogSave notify LogSave "/bin/tar -cO -C /var/InternerSpeicher/fhem
log | /bin/gzip > /var/InternerSpeicher/fhemlog-$(date
\+%%Y%%m%%d%%H%%M).tar.gz;; sleep 5;; rm -R
/var/InternerSpeicher/fhem/log/*.log"
erzielen die gleichen Ergebnisse (fhemlog-201201291459.tar.gz), man achte
auf die jeweils notwendige Anzahl der Prozentzeichen für die
Zeitstempelerzeugung.
Ignisquivir
Fritz!Box 7390 (84.05.07-21400 ), Fhem 5.2 – 7390 SVN, 2xCUL V 1.44 CUL868,
2xHM-LC-Sw4-SM, 1xHM-LCSw1-FM, KS300, 1xEUL, 2x HOPPE Fenstergriff
SecuSignal