Log analytics customisation

Regular Visitor

Hi All,


I am pretty new to azure log analytics and would appreciate if anyone would help me with below questions. 


The setting on my subscription is that all the Azure firewall logs are sent to log analytics. 


Q1 - I am trying to find traffic log from a specific source IP, but I am not sure how to edit the sample provided by Azure.     


| where Category == "AzureFirewallNetworkRule"
| parse msg_s with Protocol " request from " SourceIP ":" SourcePortInt:int " to " TargetIP ":" TargetPortInt:int *
| parse msg_s with * ". Action: " Action1a
| parse msg_s with * " was " Action1b " to " NatDestination
| parse msg_s with Protocol2 " request from " SourceIP2 " to " TargetIP2 ". Action: " Action2
| extend SourcePort = tostring(SourcePortInt),TargetPort = tostring(TargetPortInt)
| extend Action = case(Action1a == "", case(Action1b == "",Action2,Action1b), Action1a),Protocol = case(Protocol == "", Protocol2, Protocol),SourceIP = case(SourceIP == "", SourceIP2, SourceIP),TargetIP = case(TargetIP == "", TargetIP2, TargetIP),SourcePort = case(SourcePort == "", "N/A", SourcePort),TargetPort = case(TargetPort == "", "N/A", TargetPort),NatDestination = case(NatDestination == "", "N/A", NatDestination)
| project TimeGenerated, msg_s, Protocol, SourceIP,SourcePort,TargetIP,TargetPort,Action, NatDestination 


Q2- Is there any way i can change the log search so that it shows more than 10,000 records?


Q3- How can I export everything in my log analytics workspace to a csv or json file?


Thanks in advance for all your guidance!


1 Reply


A1 - The example provided below is great, because if parses the relevant fields and you'll only need to add a "where" clause to the query:

| where SourceIP == ""

 A2 - the 10K limit is a UI limit, which you currently can't bypass.

What you can do is:

- Run your queries through the LA API instead, which will return the full resultset

- Run your queries through PowerBI

- Scope your query to a specific time frame (last hour, last 6 hours etc.) which may produce smaller resultsets and not reach the 10K limit.

A3 - After running the query, select Export from the action bar (top area) and export to CSV.