Splunk Search

How to compare most recent results with previous search results?

vinchakov_a
Path Finder

Open ports are check every 5 minutes.

index=os sourcetype=openPorts host=myhost earliest = -5m@m

udp      123
udp     1514
udp     1506
udp     1505
udp     1504
udp     1503
udp     1502
udp     1501
udp      514
udp      123
udp      123
udp      123
udp      631
tcp     8000
tcp     8089
tcp       22
tcp     9997

Is it possible to compare the most recent values with the previous results?

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

Something like this

|set diff [search index=os sourcetype=openPorts host=myhost earliest = -5m@m][index=os sourcetype=openPorts host=myhost earliest = -10m@m latest=-5m@m]

Add "|table <>" to both the subsearches to better results.
There could be more better approach to this but you need to provide more details on the data, comparison you want to do to arrive on one.

View solution in original post

vinchakov_a
Path Finder

It's work:

| set diff [ | search index=os sourcetype=openPorts host=host1 earliest = -5m@m | dedup Port | table Port][ | search index=os sourcetype=openPorts host=host2 earliest = -10m@m latest=-6m@m | dedup Port | table Port]

And I recieve: No results found.

The following step a cycle of all hosts. It is real? I don't want to write alert on each host separately.

0 Karma

somesoni2
Revered Legend

Something like this

|set diff [search index=os sourcetype=openPorts host=myhost earliest = -5m@m][index=os sourcetype=openPorts host=myhost earliest = -10m@m latest=-5m@m]

Add "|table <>" to both the subsearches to better results.
There could be more better approach to this but you need to provide more details on the data, comparison you want to do to arrive on one.

vinchakov_a
Path Finder

Thank you!

0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...