Morgen,
ich würde gerne, dass alle einfließenden Daten in eine neue Tabelle SystemEventsHost1 gespeichert werden. Dazu habe die neue Tabelle in der DB angelegt:
CREATE TABLE IF NOT EXISTS `SystemEventsHost1` ( `ID` int(10) unsigned NOT NULL AUTO_INCREMENT, `CustomerID` bigint(20) DEFAULT NULL, `ReceivedAt` datetime DEFAULT NULL, `DeviceReportedTime` datetime DEFAULT NULL, `Facility` smallint(6) DEFAULT NULL, `Priority` smallint(6) DEFAULT NULL, `FromHost` varchar(60) DEFAULT NULL, `Message` text, `NTSeverity` int(11) DEFAULT NULL, `Importance` int(11) DEFAULT NULL, `EventSource` varchar(60) DEFAULT NULL, `EventUser` varchar(60) DEFAULT NULL, `EventCategory` int(11) DEFAULT NULL, `EventID` int(11) DEFAULT NULL, `EventBinaryData` text, `MaxAvailable` int(11) DEFAULT NULL, `CurrUsage` int(11) DEFAULT NULL, `MinUsage` int(11) DEFAULT NULL, `MaxUsage` int(11) DEFAULT NULL, `InfoUnitID` int(11) DEFAULT NULL, `SysLogTag` varchar(60) DEFAULT NULL, `EventLogType` varchar(60) DEFAULT NULL, `GenericFileName` varchar(60) DEFAULT NULL, `SystemID` int(11) DEFAULT NULL, `ProcessID` varchar(60) NOT NULL DEFAULT '', `checksum` int(11) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`ID`) KEY_BLOCK_SIZE=4, KEY `ReceivedAt` (`ReceivedAt`), KEY `Facility` (`Facility`), KEY `Priority` (`Priority`), KEY `FromHost` (`FromHost`), KEY `DeviceReportedTime` (`DeviceReportedTime`), KEY `SysLogTag` (`SysLogTag`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 AUTO_INCREMENT=1 ;
Danach habe die /etc/rsyslog.d/mysql.conf angepasst:
### Configuration file for rsyslog-mysql ### Changes are preserved #module (load="ommysql") #*.* action(type="ommysql" server="localhost" db="Syslog" uid="rsyslog" pwd="1234qwer") $ModLoad ommysql $template temp1,"insert into SystemEventsHost1 (Message, Facility, FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag, ProcessID) values ('%msg%', %syslogfacility%, '%HOSTNAME%', %syslogpr iority%, '%timereported:::date-mysql%', '%timegenerated:::date-mysql%', %iut%, '%syslogtag:R,ERE,1,FIELD:(.+)(\[[0-9]{1,5}\]).*--end%', '%syslogtag:R,ERE,1,BLANK:\[([0-9]{1,5})\]--end%')",SQL if ($FromHost == '*' ) then :ommysql:localhost,Syslog,rsyslog,1234qwer;temp1 #:source , isequal , "*" :ommysql:localhost,Syslog,rsyslog,1234qwer;temp1
Wenn ich Parsen mittels rsyslogd -N1 bekomme ich keine Fehlermeldung(en):
rsyslogd: version 8.32.0, config validation run (level 1), master config /etc/rsyslog.conf rsyslogd: End of config validation run. Bye.
Nur leider füllt er meine Tabelle nicht! Wie muss ich die IF-Regel schreiben, damit es klappt?