Windowsイベントログの監視定義ファイル(fluentd_@@trapname@@_wevt.conf.template)
形式
<worker 0>
## [Metric Settings]
<source>
@type exec
command "echo {}"
<parse>
@type json
</parse>
run_interval 60s
tag jpc_ima_metrics.wevt.ログ監視名
</source>
<filter jpc_ima_metrics.wevt.ログ監視名>
@type record_transformer
enable_ruby true
auto_typecast false
<record>
__name__ fluentd_logtrap_running
instance ホスト名
jp1_pc_nodelabel IM管理ノードのラベル名
jp1_pc_category カテゴリID
jp1_pc_logtrap_defname ログ監視名_wevt
jp1_pc_trendname fluentd
job jpc_fluentd
jp1_pc_nodelabel_fluentd Log trapper(Fluentd)
jp1_pc_addon_program JPC Fluentd
</record>
</filter>
</worker>
<worker workerのid>
## [Input Settings]
<source>
@type windows_eventlog2
tag wevt.ログ監視名
channels ログの種別
read_interval 2s
<storage>
@type local
path ../data/fluentd/wevt/ログ監視名
mode 0600
dir_mode 0700
pretty_print false
</storage>
read_existing_events false
render_as_xml false
rate_limit -1
preserve_qualifiers_on_hash true
read_all_channels false
event_query *
</source>
## [Attributes Settings]
<filter wevt.ログ監視名>
@type record_transformer
enable_ruby true
auto_typecast false
renew_record false
<record>
ID イベントID
JP1_SOURCEHOST ホスト名
JPC_NODELABEL IM管理ノードのラベル名
JP1_TRAP_NAME ログ監視名
# OS_VERSION OSバージョン
</record>
</filter>
## [Inclusion Settings]
#<filter wevt.ログ監視名>
# @type grep
# <regexp>
# key JP1イベントの属性名
# pattern /監視するログの正規表現/
# </regexp>
#</filter>
## [Exclusion Settings]
#<filter wevt.ログ監視名>
# @type grep
# <exclude>
# key JP1イベントの属性名
# pattern /監視しないログの正規表現/
# </exclude>
#</filter>
## [Forward Settings]
<match wevt.ログ監視名>
@type rewrite_tag_filter
<rule>
key JP1イベントの属性名
pattern /JP1イベントを発行するログの正規表現/
tag ${tag}.jp1event
</rule>
<rule>
key MESSAGE
pattern /.+/
tag ${tag}.outputlog
</rule>
</match>
<filter /wevt\.ログ監視名\.(jp1event|outputlog)/>
@type record_transformer
enable_ruby true
auto_typecast true
renew_record true
<record>
eventId ${record['ID']}
xsystem true
message ${record['MESSAGE']}
attrs ${record}
</record>
remove_keys $.attrs.ID
remove_keys $.attrs.MESSAGE
</filter>
</worker>
ファイル
fluentd_@@trapname@@_wevt.conf.template
fluentd_@@trapname@@_wevt.conf.template.model(モデルファイル)
格納先ディレクトリ
- ■統合エージェントホスト
-
-
物理ホストのとき(定義ファイルおよびモデルファイル)
Agentパス\conf\
-
論理ホストのとき(定義ファイル)
共有フォルダ\jp1ima\conf\
-
説明
Windowsイベントログを監視するための定義ファイルです。
テンプレート(fluentd_@@trapname@@_wevt.conf.template)をコピーし,コピー先のファイル名を「fluentd_ログ監視名_wevt.conf」に変更して使用します。「fluentd_ログ監視名_wevt.conf」の配置先については,マニュアル「JP1/Integrated Management 3 - Manager 導入・設計ガイド」の「付録A.4(3)統合エージェントホスト(Windows)」および「付録A.4(4)統合エージェントホスト(Linux)」を参照してください。ファイル名は,監視エージェントホスト内で重複しない名前とします。ログ監視名に使用できる文字は半角英数字,ハイフン,アンダースコアで,文字列長は1〜30文字とします。監視対象のアプリケーションごとにこの定義ファイルを作成します。
JP1/IM - Agentは,監視定義ファイルのIM管理ノードのラベル名に設定されている値に応じて,ログ監視対象のSIDのIM管理ノードを作成します。別の監視定義ファイルであってもIM管理ノードのラベル名が同一であれば,作成するIM管理ノードは1つです。
Windowsイベントログの監視機能でこの定義ファイルを読み込み,アプリケーションがWindowsイベントログに出力したログの情報を解析します。解析した情報に対して条件を指定し,条件を満たす場合,情報をJP1イベントに変換したり,Fluentdのログファイルに出力したりするよう設定することができます。発行するJP1イベントについては,「3.2.3(3)Windowsイベントログを監視して発行するJP1イベント」を参照してください。
先頭の文字が「#」である行は,コメントとして扱い,プログラムの動作には影響しません。
文字コード
UTF-8(BOM無し)
改行コード
Windowsの場合:CR+LF
定義の反映時期
Fluentdのサービスを再起動したときに,Fluentdの動作に反映します。
定義ファイルの追加,削除,または,[Metric Settings]セクションの値を変更した場合,変更内容を統合オペレーション・ビューアーのツリーに反映します。
反映方法については,マニュアル「JP1/Integrated Management 3 - Manager 構築ガイド」の「1.21.2(19)IM管理ノードのツリー情報の作成と反映(Windows)(必須)」を参照してください。
記述内容
- <worker>ディレクティブ
-
「テキスト形式のログファイルの監視定義ファイル(fluentd_@@trapname@@_tail.conf.template)」の<worker>ディレクティブと同じです。
- workerのid(オプション)
-
説明
変更可否
JP1/IM - Agentでユーザーが設定する内容
JP1/IM - Agentの初期値
「テキスト形式のログファイルの監視定義ファイル(fluentd_@@trapname@@_tail.conf.template)」のworkerのidと同じです。
変更可
「テキスト形式のログファイルの監視定義ファイル(fluentd_@@trapname@@_tail.conf.template)」のworkerのidと同じです。
2
- [Metric Settings]セクション
-
「テキスト形式のログファイルの監視定義ファイル(fluentd_@@trapname@@_tail.conf.template)」の[Metric Settings]セクションの説明を参照してください。
- [Input Settings]セクション
-
監視するイベントログの種別を指定します。
- ログ監視名(必須)
-
「テキスト形式のログファイルの監視定義ファイル(fluentd_@@trapname@@_tail.conf.template)」の[Metric Settings]セクションのログ監視名と同じです。
- ログの種別(必須)
-
監視するイベントログの種別を,コンマ区切りの256バイト以内の文字列で指定します。JP1/IM - Agentの初期値は「application, system」です。
指定できるログの種別については,マニュアル「JP1/Integrated Management 3 - Manager 導入・設計ガイド」の「3.15.3(4)(a)監視できるログの種別」を参照してください。
- [Attributes Settings]セクション
-
発行するJP1イベントの属性と属性値の設定を行います。
- ログ監視名(必須)
-
「テキスト形式のログファイルの監視定義ファイル(fluentd_@@trapname@@_tail.conf.template)」の[Metric Settings]セクションのログ監視名と同じです。
- イベントID(オプション)
-
「テキスト形式のログファイルの監視定義ファイル(fluentd_@@trapname@@_tail.conf.template)」の[Attributes Settings]セクションのイベントIDと同じです。
- ホスト名(オプション)
-
「テキスト形式のログファイルの監視定義ファイル(fluentd_@@trapname@@_tail.conf.template)」の[Attributes Settings]セクションのホスト名と同じです。
- IM管理ノードのラベル名(オプション)
-
「テキスト形式のログファイルの監視定義ファイル(fluentd_@@trapname@@_tail.conf.template)」の[Attributes Settings]セクションのIM管理ノードのラベル名と同じです。
- OSバージョン(オプション)
-
JP1イベントにOS_VERSIONの属性を追加する場合,Windowsのメジャーバージョンの番号を指定します。初期設定では「#」が行の先頭に指定されていてコメント扱いとなっているため,指定する場合は「#」を削除します。
- [Inclusion Settings]セクション
-
「テキスト形式のログファイルの監視定義ファイル(fluentd_@@trapname@@_tail.conf.template)」の[Inclusion Settings]セクションの説明を参照してください。
- [Exclusion Settings]セクション
-
「テキスト形式のログファイルの監視定義ファイル(fluentd_@@trapname@@_tail.conf.template)」の[Exclusion Settings]セクションの説明を参照してください。
- [Forward Settings]セクション
-
「テキスト形式のログファイルの監視定義ファイル(fluentd_@@trapname@@_tail.conf.template)」の[Forward Settings]セクションの説明を参照してください。
定義例
次に示す定義例では,ログの種類が「application」,ソースが「JP1/IM-Manager」の場合に監視を行い,重大度が「警告」以上のときJP1イベントを発行します。
<worker 0>
## [Metric Settings]
<source>
@type exec
command "echo {}"
<parse>
@type json
</parse>
run_interval 60s
tag jpc_ima_metrics.wevt.user_app_log
</source>
<filter jpc_ima_metrics.wevt.user_app_log>
@type record_transformer
enable_ruby true
<record>
__name__ fluentd_logtrap_running
instance hostA
jp1_pc_nodelabel ユーザーアプリケーション
jp1_pc_category applicationServer
jp1_pc_logtrap_defname user_app_log_wevt
jp1_pc_trendname fluentd
job jpc_fluentd
jp1_pc_nodelabel_fluentd Log trapper(Fluentd)
jp1_pc_addon_program JPC Fluentd
</record>
</filter>
</worker>
<worker 2>
## [Input Settings]
<source>
@type windows_eventlog2
tag wevt.user_app_log
channels application
read_interval 2
preserve_qualifiers_on_hash true
<storage>
@type local
path ../data/jp1ima/data/fluentd/wevt/user_app_log
</storage>
read_from_head false
render_as_xml false
rate_limit -1
preserve_qualifiers_on_hash true
event_query *
</source>
## [Attributes Settings]
<filter wevt.user_app_log>
@type record_transformer
enable_ruby true
renew_record false
<record>
ID 00007602
JP1_SOURCEHOST hostA
JPC_NODELABEL ユーザーアプリケーション
OS_VERSION 10
</record>
</filter>
## [Inclusion Settings]
<filter wevt.user_app_log>
@type grep
<regexp>
key PRODUCT_NAME
pattern /JP1\/IM-M$/
</regexp>
</filter>
## [Exclusion Settings]
#<filter wevt.user_app_log>
# @type grep
# <exclude>
# key
# pattern //
# </exclude>
#</filter>
## [Forward Settings]
<match wevt.user_app_log>
@type rewrite_tag_filter
<rule>
key SEVERITY
pattern /Warning|Error|Critical|Alert|Emergency/
tag ${tag}.jp1event
</rule>
<rule>
key SEVERITY
pattern /.*/
tag ${tag}.outputlog
</rule>
</match>
<filter /wevt\.user_app_log\.(jp1event|outputlog)/>
@type record_transformer
enable_ruby true
auto_typecast true
renew_record true
<record>
eventId ${record['ID']}
xsystem true
message ${record['MESSAGE']}
attrs ${record}
</record>
remove_keys $.attrs.ID
remove_keys $.attrs.MESSAGE
</filter>
</worker>