Splunk Search

lookup 正規表現

raku_sp
New Member

lookupコマンドについて確認させてください。

実現したいこと:
 CSVでシスログのホワイト・リストを作成し、シスログ参照時にCSVのホワイトリストのステータスを参照し、messageが「ignore」については表示しないようにしたいです。その際、CSVリストにあるmesssageにワイルドカード、正規表現を使うことは可能でしょうか。

lookup white_list message | search RESULT=ignore

Tags (2)
0 Karma

HiroshiSatoh
Champion

試しにmesssageに*を設定してlookupしてみましたが、*は*としか連結しないので使えないと思います。
lookupを抽出条件として使う場合は以下のようなサブサーチでの使い方が普通だと思いますが、実現したいことと上の説明、サーチ文はあってますか?

フィールド指定での抽出
index=* [inputlookup xxx.csv | fields col_a]
->(col_a=1) OR (col_a=2) OR (col_a=3) ・・・・

フィールド指定なしで抽出(_rawを検索)
index=* [inputlookup xxx.csv | rename col_a as query | fields query]
->(1) OR (2) OR (3) ・・・・

0 Karma

raku_sp
New Member

こんな感じで使ってます。
lookup syslog_white_list MSG | search NOT RESULT=IGNORE

csvは以下のようになってます。

MSG RESULT

hogehoge IGNORE
foobar IGNORE

0 Karma

HiroshiSatoh
Champion

例えば
hogehoge IGN*
foobar IG*E
としたいということであれば正規表現やワイルドカードは使えません。

RESULTの値にバリエーションがあるということですか?値に対しては大文字、小文字を区別しないので現状は
IGNORE、ignore、IGNoreでも一致します。

0 Karma

raku_sp
New Member

説明下手ですみません、バリエーションがあるのはMSGのカラムですね。 そこにシスログが入る形になります。

Jul 27 09:49:38 itbsv1 su(pam_unix)[8061]: session opened for user root by root(uid=0)

となると、search NOT (MSG="pam_" OR MSG="(pam_unix" )
などで除外するしか方法はないですかね

0 Karma

HiroshiSatoh
Champion

そうなりますが、この場合はワイルドカードが使えるので
例えば、MSG="pam_"と設定することは可能です。

0 Karma

raku_sp
New Member

なるほど。ありがとうございます。検討してみます。

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...