![NxLog の「and」ロジック](https://rvso.com/image/696989/NxLog%20%E3%81%AE%E3%80%8Cand%E3%80%8D%E3%83%AD%E3%82%B8%E3%83%83%E3%82%AF.png)
現在、さまざまなドメイン コントローラーで NxLog を実行して、ログイン/ログアウト イベントを取得しています。
Exec if $TargetUserName =~ /(\S+\$|user1|user2|user3|user4)/ drop(); \
else if ($EventID == 4624 or $EventID == 4625 or $EventID == 4648 or $EventID == 4768) $raw_event = "Time:" + $EventTime + ", EventID:" + $EventID + ", Keyword:" + $Status + ", LogonType:" + $LogonType + ", User:" + $TargetDomainName + "\\" + $TargetUserName + ", IPAddr:" + $IPAddress; \
else if $raw_event =~ /^(.+)(Detailed Authentication Information:|Additional Information:)/ $raw_event = $1; if $raw_event =~ s/\t/ /g {}
上記の設定は、$ を含むユーザー名と指定したユーザー名を無視する点で正常に動作しますが、それらのユーザー名を含むイベント ID 4624 のみを無視して、失敗したログインを確認できるようにしたいと考えています。次の設定は動作すると思いましたが、構文エラーが発生し続けます。
Exec if ($EventID == 4624 and $TargetUserName =~ /(\S+\$|user1|user2|user3|user4)/ drop(); \
else if ($EventID == 4624 or $EventID == 4625 or $EventID == 4648 or $EventID == 4768) $raw_event = "Time:" + $EventTime + ", EventID:" + $EventID + ", Keyword:" + $Status + ", LogonType:" + $LogonType + ", User:" + $TargetDomainName + "\\" + $TargetUserName + ", IPAddr:" + $IPAddress; \
else if $raw_event =~ /^(.+)(Detailed Authentication Information:|Additional Information:)/ $raw_event = $1; if $raw_event =~ s/\t/ /g {}
ご協力いただければ幸いです。
編集:完全を期すために、$ を含むユーザー名を除外し、その後、気にしないチャットの多いさまざまなアカウントでの成功/Kerb イベントを除外するための最終的な構成を以下に示します。
Exec if $TargetUserName =~ /(\S+\$)/ drop(); \
else if ($EventID == 4624 and $TargetUserName =~ /(user1|user2|user3|user4)/) drop(); \
else if ($EventID == 4648 and $TargetUserName =~ /(user1|user2|user3|user4)/) drop(); \
else if ($EventID == 4624 or $EventID == 4625 or $EventID == 4648 or $EventID == 4768) $raw_event = "Time:" + $EventTime + ", EventID:" + $EventID + ", Keyword:" + $Status + ", LogonType:" + $LogonType + ", User:" + $TargetDomainName + "\\" + $TargetUserName + ", IPAddr:" + $IPAddress; \
else if $raw_event =~ /^(.+)(Detailed Authentication Information:|Additional Information:)/ $raw_event = $1; if $raw_event =~ s/\t/ /g {}
答え1
構文エラーの原因は、括弧が正しくペアになっていないことです。次のようになります。
Exec if ($EventID == 4624 ... ) drop();
^ ^