rsyslog template - Fehler beim Parsen des regulären Ausdrucks

Ich versuche, Protokolle von meinem D-Link DAP-2310 in einem rsyslog-Server zu strukturieren. Es hat ein nicht standardmäßiges Protokollformat und ich habe die Idee, dies mit regulären Ausdrücken in einer rsyslog-Vorlage zu beheben. Wenn ich die rsyslog.conf mit rsyslogd -N1 parse, ist das Ergebnis wirklich deprimierend.

Das msg-Datenelement sieht aus wieAA:BB:CC:DD:EE] [app-name] log message Der erste Teil ist eine Mac-Adresse, bei der der erste Teil „[00:“ in einem anderen Datenelement platziert ist. Fragen Sie nicht, warum. Teil zwei „[App-Name]“ ist die Anwendung / Instanz, die die Nachricht sendet. Der letzte Teil "Protokollmeldung" ist die protokollierte Aktion.

Die interessanten Teile sind i) App-Name und ii) Logmeldung.

Ich habe nach regulärem Ausdruck bei @ validiehttp: //www.rsyslog.com/regex und beide wirken wie ein Zauber.

\ [(. +) \] \ [. + \] (. +)

Die vollständige Vorlagendeklaration sieht wie folgt aus:

template(name=”AP_tmpl” type=”list”) {   
    property(name=”timestamp”)    
    constant(value=” “)   
    property(name=”hostname”)
    constant(value=” “)   
    property(name=”msg” 
        regex.type=”ERE” 
        regex.submatch=”1”    
        regex.expression=”\[(.+)\]--end”
        regex.nomatchmode=”BLANK”
    )   
    constant(value=” “)
    property(name=”msg” 
        regex.type=”ERE”
        regex.submatch=”1”
        regex.expression=”\[.+\](.+)$--end”   
        regex.nomatchmode=”BLANK”
    )    
    constant(value=”\n“) 
}

Wenn ich die conf-Datei parse, beschwere ich mich über Escape-Zeichen.

tobias@ubuntutest:~$ sudo rsyslogd -N1
rsyslogd: version 7.4.4, config validation run (level 1), master config /etc/rsyslog.conf
rsyslogd: error during parsing file /etc/rsyslog.d/41-AP.conf, on or before line 20: invalid character '"' in object definition - is there an invalid escape sequence somewhere? [try http://www.rsyslog.com/e/2207 ]
rsyslogd: error during parsing file /etc/rsyslog.d/41-AP.conf, on or before line 20: invalid character '\' in object definition - is there an invalid escape sequence somewhere? [try http://www.rsyslog.com/e/2207 ]
rsyslogd: error during parsing file /etc/rsyslog.d/41-AP.conf, on or before line 20: invalid character '.' in object definition - is there an invalid escape sequence somewhere? [try http://www.rsyslog.com/e/2207 ]
rsyslogd: error during parsing file /etc/rsyslog.d/41-AP.conf, on or before line 20: invalid character '*' in object definition - is there an invalid escape sequence somewhere? [try http://www.rsyslog.com/e/2207 ]
rsyslogd: error during parsing file /etc/rsyslog.d/41-AP.conf, on or before line 20: invalid character '\' in object definition - is there an invalid escape sequence somewhere? [try http://www.rsyslog.com/e/2207 ]
rsyslogd: error during parsing file /etc/rsyslog.d/41-AP.conf, on or before line 20: syntax error on token ']' [try http://www.rsyslog.com/e/2207 ]
rsyslogd: CONFIG ERROR: could not interpret master config file '/etc/rsyslog.conf'. [try http://www.rsyslog.com/e/2207 ]
rsyslogd: run failed with error -2207 (see rsyslog.h or try http://www.rsyslog.com/e/2207 to learn what that number means)

Ich kann nicht herausfinden, warum die regulären Ausdrücke fehlerfrei validiert werden.http: //www.rsyslog.com/e/220 gibt nichts. Irgendwelche Ideen

Antworten auf die Frage(2)

Ihre Antwort auf die Frage