3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

SplunkのForwarder機能を駆使してデータの複製/切出し転送にトライ

Posted at

はじめに

  • SplunkのForwarder使ってデータを複製して、メイン機とは異なる別のSplunkに二重転送したり
  • 必要なデータソースだけ切出して特定のIDXに転送したり 等
  • データをマルチパスに制御して送りたいという要件がでてくることがままあります
  • そんなときにシンプルな複製から、ちょっと込み入った切出し転送方法をいくつかまとめて紹介します

大別するとこんな感じ

  • 複製編

    • 全データまるごと複製
    • 特定のソースタイプのみ複製
  • 切出して転送編

    • 特定hostを含むデータのみ別IDXに転送
    • 特定の監視対象ファイルのみ別IDXに転送

(複製編)How to

全データまるごと複製

設定例:

outputs.conf
[tcpout]
defaultGroup=cloned_group1,cloned_group2

[tcpout:cloned_group1]
server=10.10.10.1:9997, 10.10.10.2:9997, 10.10.10.3:9997

[tcpout:cloned_group2]
server=10.1.1.197:9997, 10.1.1.198:9997, 10.1.1.199:9997, 10.1.1.200:9997

特定のソースタイプのみ複製

設定例:

  • sourcetypeがWinEventLog://Microsoft-Windows-Sysmon/Operationalのデータを2つの_TCP_ROUTING先に転送(カンマで区切る)
inputs.conf
[WinEventLog://Microsoft-Windows-Sysmon/Operational]
_TCP_ROUTING = basic_indexer,mss_indexer
  • _TCP_ROUTING先はoutputs.confにて指定
outputs.conf
[tcpout:basic_indexer]
server = 13.xx.xx.138:9997

[tcpout:mss_indexer]
server = 192.xx.xx.191:9997

(切出して転送編)How to

特定hostを含むデータのみ別IDXに転送

設定例:

  • まずpropsにて、別転送用のポリシー(otherRouting)を定義。この時、hostフィール名にipxxx.us-west-1.compute.internalが含まれるデータが対象となる
props.conf
[host::ipxxx.us-west-1.compute.internal] 
TRANSFORMS-routing = otherRouting
  • 次にREGEXで対象データがマッチングする条件を定義。この場合、なんでもマッチするようにしている。DEST_KEYをセット。ポイントはFORMATにてoutputs.confで読み込む定義名を揃える必要あり
transforms.conf.conf
[otherRouting]
REGEX = .* 
DEST_KEY=_TCP_ROUTING 
FORMAT=other
  • 最後にoutputsにてtransformで定義したotherという名称でtcpoutスタンザを定義
outputs.conf
[tcpout]
defaultGroup = default-autolb-group 

[tcpout:default-autolb-group]
server = xxx.xxx.xxx.97:9997

[tcpout:other]
server = xxx.xxx.xxx.18:9997 

特定の監視対象ファイルのみ別IDXに転送

  • HF上で複数のファイルを監視対象にしている際に、特定ファイルのログだけ別のIDXに転送したい場合にお勧め

設定例:

  • InterSafe_http.logを送る先としてiswf_routingポリシーを定義。同様にsecureログ送る先としてlinux_routingポリシーを定義
inputs.conf
[monitor:///usr/local/intersafe/logs/InterSafe_http.log] 
_TCP_ROUTING = iswf_routing
sourcetype = intersafe_http

[monitor:///var/log/secure] 
_TCP_ROUTING = linux_routing 
sourcetype = linux_secure
  • tcpoutにてそれぞれのポリシーをセットして、転送したいIDXのserverを設定するだけ
outputs.conf
[tcpout:default-autolb-group] 
server = 54.xxx.xxx.50:9997

[tcpout:iswf_routing]
server = 13.xxx.xxx.97:9997

[tcpout:linux_routing]
server = 54.xxx.xxx.44:9997

最後に

  • 実はまだやり方が見つかってないのですが、全データをIDX-Aに転送しつつ、特定の文字列を含むデータをIDX-Bにも転送するというハイブリッドなやり方が分かってません。
  • ご存知の方いたらコメントにて教えてほしいです
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?