Created
October 18, 2018 21:51
-
-
Save marknettle/13fd0c49fe9eeb400572b279790f78bf to your computer and use it in GitHub Desktop.
Kusto query to extract useful fields from Azure Firewall logs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AzureDiagnostics | |
| where ResourceType == "AZUREFIREWALLS" | |
| extend | |
proto = extract(@"^([A-Z]+) ",1,msg_s) | |
,src_host = extract(@"request from ([\d\.]*)",1,msg_s) | |
,src_port = extract(@"request from [\d\.]*:(\d+)",1,msg_s) | |
,dest_host = extract(@" to ([-\w\.]+)(:|\. |\.$)",1,msg_s) | |
,dest_port = extract(@" to [-\w\.]+:(\d+)",1,msg_s) | |
,action = iif( | |
msg_s has "was denied" | |
,"Deny" | |
,extract(@" Action: (\w+)",1,msg_s)) | |
,rule_coll = extract(@" Rule Collection: (\w+)",1,msg_s) | |
,rule = coalesce( | |
extract(@" Rule: (.*)",1,msg_s) | |
,extract("No rule matched",0,msg_s)) | |
,reason = extract(@" Reason: (.*)",1,msg_s) | |
| project TimeGenerated,Category,proto,src_host,src_port,dest_host,dest_port,action,rule_coll,rule,reason,msg_s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, Just to confirm this still works.