Splunk Search

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

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

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

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

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

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

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

Contributor

What does your search look like so far?

0 Karma
State of Splunk Careers

Access the Splunk Careers Report to see real data that shows how Splunk mastery increases your value and job satisfaction.

Find out what your skills are worth!