「check_logfiles」と呼ばれるnagiosチェックを使用して、一連のsolarisマシンでsyslogを解析しています。これは完全に Perl で書かれており、Perl 構文も使用する構成ファイルを使用します。正規表現を使用して、チェックの出力から次の行を除外しようとしています:
Nov 16 19:15:04 db07 Cluster.CCR: [ID 574345 daemon.debug] server address: 127.0.0.1
これは私が使用しようとしている正規表現です(失敗しました)
'^.*?(Cluster.CCR).*?$'
これは、コンテキストが必要な場合に備えて、チェック用の構成ファイル全体です。
$options = 'report=long';
@searches = (
{
tag => 'syslog',
logfile => '/var/adm/messages',
rotation => 'SOLARIS',
options => 'noprotocol',
sticky => 2400,
criticalpatterns => [
'daemon.debug',
'daemon.error',
'Could not send report: Broken pipe',
'Could not retrieve catalog from remote server: Error 400 on SERVER'
],
warningpatterns => [
'daemon.warning',
'daemon.info',
'daemon.notice',
'kern',
],
criticalexceptions => [
'connect from nagioszone01.mydomain.com',
'from 10.20.28.140',
'Finished catalog run in',
'Did not receive identification string from',
'^.*?(Cluster.CCR).*?$'
],
warningexceptions => [
'connect from nagioszone01.mydomain.com',
'from 10.20.28.140',
'Finished catalog run in',
'Did not receive identification string from',
'Cluster.CCR'
],
options => 'logfilenocry,sticky=900',
});
共有する必要があるアドバイスをありがとう