Hauptmenü

Monatslogfiles splitten

Begonnen von yetiman, 16 November 2014, 23:17:02

Vorheriges Thema - Nächstes Thema

yetiman

Hallo,

momentan wird in meiner Konfiguration per folgendem Attribute
attr global logfile ./log/fhem-%Y-%m.log

ein Monatslogfile geschrieben.
Wenn man das Logging zwischendurch auf 5 stellt, wird das Logfile sehr gross uns der RaPi braucht sehr lange um das Log anzuzeigen.
Gibt es eine simple Methode um das Log z.B. wöchentlich oder noch besser alle 3 Tage neu anzulegen?

Ingo

franky08

#1
Guck dir in der commandref mal Filelog an, dass ist dort beschrieben %Y steht für jahr %m für Monat. Da findest du auch was für Woche und Tag.

Zitatdefine <name> FileLog <filename> <regexp>

Log events to <filename>. The log format is

YYYY-MM-DD_HH:MM:SS <device> <event>

The regexp will be checked against the device name devicename:event or timestamp:devicename:event combination. The regexp must match the complete string, not just a part of it.
<filename> may contain %-wildcards of the POSIX strftime function of the underlying OS (see your strftime manual). Common used wildcards are:
%d day of month (01..31)
%m month (01..12)
%Y year (1970...)
%w day of week (0..6); 0 represents Sunday
%j day of year (001..366)
%U week number of year with Sunday as first day of week (00..53)
%W week number of year with Monday as first day of week (00..53)
FHEM also replaces %L by the value of the global logdir attribute.
Before using %V for ISO 8601 week numbers check if it is correctly supported by your system (%V may not be replaced, replaced by an empty string or by an incorrect ISO-8601 week number, especially at the beginning of the year) If you use %V you will also have to use %G instead of %Y for the year!

VG
Frank
Debian Bookworm auf HUNSN / Debian Bullseye auf 2.ter HUNSN F2F an 2x RaspiB
mit FHEM aktuell
22Zoll ViewSonic als Infodislay (WVC)
3xHMLAN mit vccu, raspmatic_rpi3, HMIP-HCU1

yetiman

Hi Frank,

danke für die schnelle Hilfe.
Bin jetzt nicht gleich drauf gekommen, dass das die gleiche Syntax wie im Filelog ist.

Das hier langt mir erst mal:

attr global logfile ./log/fhem-%Y-%W.log

Damit macht er mir jede Woche ein neues Logfile :-)


Ingo