Getting Data In

Finding forwarders that have not sent data

sverdhan
Loves-to-Learn Lots

Hello , 

Can anyone please provide me a query which lists out  all forwarders that have not send data over the last 30 days?

 

Thank you

Labels (2)
0 Karma

livehybrid
SplunkTrust
SplunkTrust

Hi @sverdhan 

I would avoid looking at things like index=* because this is very resource intensive and also may include hosts which are not forwarders!

Instead you can utilise the _metrics index which is very fast and efficient, you could try something like this:

|mstats latest_time(_value) as latest_time WHERE earliest=-31d latest=now index=_metrics metric_name="spl.mlog.tcpin_connections._tcp_eps" source="/opt/splunk/var/log/splunk/metrics.log" group=tcpin_connections by hostname 
| eval notSeenFor30Days=IF(latest_time<now()-(60*60*24*30),"NotSeen","Seen")
| eval lastSeen=tostring(now()-latest_time,"duration")

I would usually recommend having a lookup of "known forwarders" for this task and then update it with when it was last seen, that way you wouldnt need to look back 30 days each time.

🌟 Did this answer help you? If so, please consider:

  • Adding karma to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing

LAME-Creations
Path Finder

@livehybrid recommended using a lookup to track your Forwarders.  I have to say that this is a really valuable tool, because if you keep track of your forwarders using a lookup, you can see what systems have not reported easily but you can also see any new forwarders that are sending logs to your system that you didn't know about.  

Below is a youtube video tutorial on using the lookup to track systems no longer sending logs.  
https://youtu.be/lo4_MIfTJzI?si=WfHxtBzTHLxmhQpe

All of the posts are good ideas.  The lookup is just one way to do it that is quick and easy, but there are many ways to do things in splunk, this is just my favorite way.  

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @sverdhan ,

see in the Monitoring Console the "DMC Alert - Missing forwarders" alert

| inputlookup dmc_forwarder_assets
| search status="missing" 
| rename hostname as Instance

otherwise, if you want to know the clients that were connected in the last 30 days but not in the last hour, you could run something like this:

| tstats latest(_time) AS _time count where index=_internal BY host
| eval period=if(_time>now()-3600,"Last hour","Previous")
| stats 
     dc(period) AS period_count 
     values(period) AS period 
     latest(_time) AS _time
     BY host
| where period_count=1 AND period="Last hour"
| table host _time

Ciao.

Giuseppe

kiran_panchavat
Champion

@sverdhan 

| metadata type=hosts index=* earliest=-30d@d
| eval age = now() - lastTime
| eval last_seen = strftime(lastTime, "%Y-%m-%d %H:%M:%S")
| where age > 30*24*60*60
| eval age_days = round(age/(24*60*60), 2)
| table host, last_seen, age_days
| rename host as "Forwarder", last_seen as "Last Data Received", age_days as "Days Since Last Data"

kiran_panchavat_1-1750417661835.png

 

Did this help? If yes, please consider giving kudos, marking it as the solution, or commenting for clarification — your feedback keeps the community going!
0 Karma

kiran_panchavat
Champion

@sverdhan 

kiran_panchavat_0-1750417565991.png
| tstats latest(_time) as lastTime where index=* by host 
| eval age=now()-lastTime
| where age > 2592000
| convert ctime(lastTime)
| rename host as "Forwarder Host", lastTime as "Last Data Received Time", age as "Age (in seconds)"
| sort - "Age (in seconds)"

Did this help? If yes, please consider giving kudos, marking it as the solution, or commenting for clarification — your feedback keeps the community going!
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...