contains
contains operator は 2 つの parse されたフィールドの文字列値を比較し、最初のフィールド値に 2 番目のフィールド値が含まれているかどうかを、ブール値の結果で返します。
構文
contains(<field1>, <field2>) as <field>
<field1> contains <field2> as <field>
| where <field1> contains <field2>
| where contains(<field1>, <field2>)
ルール
- フィールド値は文字列である必要があります。必要であれば値をキャストできます。
- field2 の文字列全体が field1 に存在している必要があります。
- 比較では大文字と小文字が区別されます。
- field2 の値が field1 に含まれていれば
true
、含まれていなければfalse
を返します。 - field1 と field2 がどちらも空であれば
true
、片方だけが空であればfalse
を返します。
例
以下のサンプル ログがあるとします。
instance of alertNotification{ EventIdentifier = 100; Address = 123 Main Street, San Francisco, California; City = San Francisco; State = CA;}
ログでは city
の値が「San Francisco」で、address
の値が「123 Main Street, San Francisco, California」になっていますので、contains operator を使用して、city
の値が address
に含まれていれば true を返すように指定できます。
| where contains(address, city)