Good morning Splunkers, I trust everyone is remaining safe.
Ultimately, I'm attempting to obtain the overage connection duration of external IPs for each destination zone based on firewall logs. The reporting period would be 24h. So the output I'd be looking for is something like this:
dest_zone AvgDuration
ABC App 00:00:07:123
123 Zone 00:00:13:123
Cisco VPN 00:07:12:004
Please see my non-working query below:
index="pan_logs" sourcetype="pan_traffic" action="allowed"
| eventstats earliest(_time) as earliest_time by src_ip
| eventstats latest(_time) as latest_time by src_ip
| eval Duration=latest_time-earliest_time
| stats avg(Duration) as AvgDuration by src_ip
| eval AvgDuration = strftime(AvgDuration/1000 , "%H:%M:%S:%3Q")
| stats values(AvgDuration) by dest_zone
As always, any help is greatly appreciated.
seems like your | stats
doesnt take into consideration the field dest_zone
so its being stripped away and cannot be used
try to add it as a split by to your | stats
what does it looks like?
.... | stats avg(Duration) as AvgDuration by src_ip dest_zone
| eval AvgDuration = strftime(AvgDuration/1000 , "%H:%M:%S:%3Q")
| stats values(AvgDuration) by dest_zone ...
also maybe try this:
index="pan_logs" sourcetype="pan_traffic" action="allowed"
| stats min(_time) as earliest_time max(_time) as latest_time by src_ip dest_zone
| eval Duration=latest_time-earliest_time
| stats avg(Duration) as AvgDuration by dest_zone
| eval AvgDuration = strftime(AvgDuration/1000 , "%H:%M:%S:%3Q")
hope it helps
seems like your | stats
doesnt take into consideration the field dest_zone
so its being stripped away and cannot be used
try to add it as a split by to your | stats
what does it looks like?
.... | stats avg(Duration) as AvgDuration by src_ip dest_zone
| eval AvgDuration = strftime(AvgDuration/1000 , "%H:%M:%S:%3Q")
| stats values(AvgDuration) by dest_zone ...
also maybe try this:
index="pan_logs" sourcetype="pan_traffic" action="allowed"
| stats min(_time) as earliest_time max(_time) as latest_time by src_ip dest_zone
| eval Duration=latest_time-earliest_time
| stats avg(Duration) as AvgDuration by dest_zone
| eval AvgDuration = strftime(AvgDuration/1000 , "%H:%M:%S:%3Q")
hope it helps
Nice. You also combined the eventstats to make them more efficient.