diff --git a/fhem/FHEM/92_FileLog.pm b/fhem/FHEM/92_FileLog.pm
index 13509ad32..a81c97aa4 100644
--- a/fhem/FHEM/92_FileLog.pm
+++ b/fhem/FHEM/92_FileLog.pm
@@ -42,6 +42,7 @@ FileLog_Initialize($)
# logtype is used by the frontend
no warnings 'qw';
my @attrList = qw(
+ acceptedRange
addLog
addStateEvent:0,1
archiveCompress
@@ -304,6 +305,7 @@ FileLog_Log($$)
my $written = 0;
my $fmt = AttrVal($ln, "outputFormat", undef);
my $emi = $log->{".filelog-event-min-interval"};
+ my $ar = $log->{".acceptedRange"};
my $al = $log->{".addLog"};
for (my $i = 0; $i < $max; $i++) {
@@ -324,10 +326,24 @@ FileLog_Log($$)
}
}
}
+
if($al && $al->{$n} && $s =~ m/^([^:]+):/) {
my $ale = $al->{$n}{$1};
$ale->{LAST} = time_str2num($t) if($ale);
}
+
+ if($ar) {
+ my $doSkip=0;
+ my @sa = split(" ", $s);
+ for my $col (keys %{$ar}) {
+ next if($col > int(@sa));
+ my $val = $sa[$col];
+ next if(!looks_like_number($val));
+ $doSkip = 1 if($val < $ar->{$col}{min} || $val > $ar->{$col}{max});
+ }
+ next if($doSkip);
+ }
+
$t =~ s/ /_/; # Makes it easier to parse with gnuplot
if(!$switched) {
@@ -374,6 +390,20 @@ FileLog_Attr(@)
return;
}
+ if($a[2] eq "acceptedRange") {
+ if($a[0] eq "del") {
+ delete($defs{$a[1]}{".acceptedRange"});
+ return;
+ }
+
+ my %ar; # colX:min:max
+ my $in = $a[3];
+ $in =~ s/\b(\d+):([0-9.-]+):([0-9.-]+)\b/
+ $ar{$1}{min}=$2; $ar{$1}{max}=$3; ""/ge;
+ return "Bad argument $in" if($in !~ m/^ *$/);
+ $defs{$a[1]}{".acceptedRange"} = \%ar;
+ }
+
if($a[0] eq "set" && $a[2] eq "ignoreRegexp") {
return "Missing argument for ignoreRegexp" if(!defined($a[3]));
eval { "HALLO" =~ m/$a[3]/ };
@@ -1289,12 +1319,12 @@ FileLog_regexpFn($$)
=item summary_DE schreibt Events in eine Logdatei
=begin html
-
+
FileLog
-
+
Define
define <name> FileLog <filename> <regexp> [readonly]
@@ -1342,7 +1372,7 @@ FileLog_regexpFn($$)
-
+
Set
- reopen
@@ -1390,7 +1420,7 @@ FileLog_regexpFn($$)
-
+
Get
get <name> <infile> <outfile> <from>
@@ -1458,12 +1488,19 @@ FileLog_regexpFn($$)
-
+
Attributes
- addStateEvent
-
+
+ - acceptedRange col1:min:max ...
+ This attribute takes a space separated list of ranges. An event wont
+ be logged, if the column of the event (counted from 0) is a number, and
+ it is outside of the specified range.
+
+
+
- addLog
This attribute takes a comma-separated list of
devspec:reading:maxInterval triples. You may use regular expressions
@@ -1472,9 +1509,9 @@ FileLog_regexpFn($$)
has arrived.
-
-
-
+
+
+
- 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
@@ -1496,13 +1533,13 @@ FileLog_regexpFn($$)
FHEM logfile only.
-
+
- archiveCompress
If nrarchive, archivedir and archiveCompress is set, then the files
in the archivedir will be compressed.
-
+
- createGluedFile
If set (to 1), and the SVG-Plot requests a time-range wich is stored
in multiple files, a temporary file with the content of all files will
@@ -1513,7 +1550,7 @@ FileLog_regexpFn($$)
- disabledForIntervals
-
+
- eventOnThreshold
If set (to a nonzero number), the event linesInTheFile will be
generated, if the lines in the file is a multiple of the set number.
@@ -1521,7 +1558,7 @@ FileLog_regexpFn($$)
feature was implemented. A FHEM crash or kill will falsify the counter.
-
+
- filelog-event-min-interval
This attribute takes a comma-separated list of
devspec:reading:minInterval triples. You may use regular expressions
@@ -1533,7 +1570,7 @@ FileLog_regexpFn($$)
- label
-
+
- logtype
Used by FHEMWEB to offer gnuplot/SVG images made from the
logs. The string is made up of tokens separated by comma (,), each
@@ -1547,14 +1584,14 @@ FileLog_regexpFn($$)
- mseclog
-
+
- outputFormat <perlCode>
If set, the result of the evaluated perlCode will be written to the file.
Default is "$TIMESTAMP $NAME $EVENT\n".
Note: only this format ist compatible with the SVG Editor
-
+
- reformatFn <perlFunctionName>
used to convert "foreign" logfiles for the SVG Module, contains the
name(!) of a function, which will be called with a "raw" line from the
@@ -1584,12 +1621,12 @@ FileLog_regexpFn($$)
=begin html_DE
-
+
FileLog
-
+
Define
define <name> FileLog <filename> <regexp> [readonly]
@@ -1643,7 +1680,7 @@ FileLog_regexpFn($$)
-
+
Set
- reopen
@@ -1694,7 +1731,7 @@ FileLog_regexpFn($$)
-
+
Get
get <name> <infile> <outfile> <from>
@@ -1773,12 +1810,20 @@ FileLog_regexpFn($$)
-
+
Attribute
- addStateEvent
-
+
+ - acceptedRange col1:min:max ...
+ Dieses Attribut spezifiert eine durch Leerzeichen getrennte Liste von
+ Bereichen. Falls die Spalte (gerechnet ab 0) eines Events eine Zahl
+ ist, und ausserhalb dieses Bereiches liegt, wird das Event nicht
+ geloggt.
+
+
+
- addLog
Dieses Attribut enthält eine durch Kommata getrennte Liste von
"devspec:readings:maxInterval" Tripel. readings kann ein regexp sein.
@@ -1786,9 +1831,9 @@ FileLog_regexpFn($$)
wird der letzte Wert zum Logfile hinzugefuegt.
-
-
-
+
+
+
- archivecmd / archivedir / nrarchive
Wenn eine neue FileLog-Datei geöffnet wird, wird der FileLog
archiver aufgerufen. Das geschieht aber nur , wenn der Name der Datei
@@ -1812,13 +1857,13 @@ FileLog_regexpFn($$)
auschließlich auf das FHEM logfile
Auswirkungen.
-
+
- archiveCompress
Falls nrarchive, archivedir und archiveCompress gesetzt ist, dann
werden die Dateien im archivedir komprimiert abgelegt.
-
+
- createGluedFile
Falls gesetzt (1), und im SVG-Plot ein Zeitbereich abgefragt wird, was
in mehreren Logdateien gespeichert ist, dann wird für die Anfrage
@@ -1829,7 +1874,7 @@ FileLog_regexpFn($$)
- disabledForIntervals
-
+
- eventOnThreshold
Falls es auf eine (nicht Null-) Zahl gesetzt ist, dann wird das
linesInTheFile Event generiert, falls die Anzahl der Zeilen in der
@@ -1839,7 +1884,7 @@ FileLog_regexpFn($$)
verfälscht die Zählung.
-
+
- filelog-event-min-interval
Dieses Attribut enthält eine durch Kommata getrennte Liste von
"devspec:readings:minInterval" Tripel. readings kann ein regexp sein.
@@ -1849,7 +1894,7 @@ FileLog_regexpFn($$)
- ignoreRegexp
-
+
- logtype
Wird vom SVG Modul benötigt, um daten grafisch aufzubereiten.
Der String wird aus komma-separierten Tokens
@@ -1897,14 +1942,14 @@ FileLog_regexpFn($$)
- mseclog
-
+
- outputFormat <perlCode>
Falls gesetzt, ist die Ausgabezeile das Ergebnis der Auswertung.
Voreinstellung ist "$TIMESTAMP $NAME $EVENT\n".
Achtung: nur dieses Format ist kompatibel mit dem SVG-Editor.
-
+
- reformatFn <perlFunktionsName>
wird verwendet, um "fremde" Dateien für die SVG-Anzeige ins
FileLog-Format zu konvertieren. Es enthält nur den Namen einer