Splunk Search

How to generate a search that determines inactivity of firewall rules?

elpfarr
Explorer

I'm having issues creating a search that determines inactivity of firewall rules. I'd like to determine if a firewall rule was seen 31+ days ago, but has not reported in the last 30 days.

For example, if "fwrule=3001" was triggered 31 days ago, but not since, it should populate my report.

0 Karma
1 Solution

elpfarr
Explorer

This search is working for me, I've validated the output and it's accurate. I can change "-30d" to whatever time frame the search should alert on.

ex. "-7d" = displays rules that haven't fired in the last 7 days, but have before that

I've set my time range to "All Time."
I'm open for comments on making this more efficient

 sourcetype="my_source" fwrule="*"
| stats latest(_time) as Time by fwrule
| where relative_time(now(), "-30d") > Time
| eval Last_seen=strftime(Time, "%m/%d/%y %H:%M:%S")
| fields - Time
| sort - Last_seen

View solution in original post

0 Karma

elpfarr
Explorer

This search is working for me, I've validated the output and it's accurate. I can change "-30d" to whatever time frame the search should alert on.

ex. "-7d" = displays rules that haven't fired in the last 7 days, but have before that

I've set my time range to "All Time."
I'm open for comments on making this more efficient

 sourcetype="my_source" fwrule="*"
| stats latest(_time) as Time by fwrule
| where relative_time(now(), "-30d") > Time
| eval Last_seen=strftime(Time, "%m/%d/%y %H:%M:%S")
| fields - Time
| sort - Last_seen
0 Karma

troyward
Explorer
<base search>
| stats latest by fwrule as last_seen
| eval days_since = (now() - last_seen) / 86400 
0 Karma

elpfarr
Explorer

I performed the search, and had to make a few adjustments (no results from above search):

| stats latest(_time) as Time by fwrule

From here, I'm having issues with the eval function. My stats statement records 'Time' in epochtime, but I need to then find all rules that have had their latest 30 days before now. Any other ideas?

0 Karma

troyward
Explorer

When you do the eval and get the difference between now and the event date and then device that by 86400 that gives you the number of days since it fired. Then just filter with the search command for days_since > 30

0 Karma

adayton20
Contributor

What does your search look like so far?

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...