Splunk Search

How to find any index that is listed in the lookup, but not listed from the below query?

MG
Engager

I have the actual list of indexes in a lookup file. I ran below query to find the list of indexes with the latest ingestion time. how to find is there any index which is listed in the lookup, but not listed from the below query.

index=index*
| stats latest(_time) as latestTime by index
| eval latestTime=strftime(latestTime,"%x %X")
Can you please help

Labels (1)
0 Karma

MG
Engager

the join is not working

0 Karma

andrew_nelson
Communicator

What are the field names in your lookup. I assumed that your list of indexes was in a field called index. 

0 Karma

MG
Engager

yes..the lookup column names are index and count

0 Karma

andrew_nelson
Communicator

My mistake, it should be max(_time). I've fixed it in the other reply.

0 Karma

andrew_nelson
Communicator

Start with your lookup as the base, then join on the the search data. Also, use tstats for something like this. 

 

 

| inputlookup index_list 
| join type=left index 
[|tstats max(_time) as latestTime where index=* by index 
| eval latestTime=strftime(latestTime,"%x %X")] 
| where isnull(latestTime)

 

 

0 Karma

MG
Engager

|tstats latest(_time) as latestTime where index=* by index
| eval latestTime=strftime(latestTime,"%Y/%m/%d %H:%M:%S")
| eval status=if(strftime(latestTime, "%Y/%m/%d") != strftime(now(), "%Y/%m/%d"), "not updated", "updated")

i'm using this query to find the index which is not indexed till today..For all the indexes i'm getting updated, eventhough there are indexes which are not updated a week. 

0 Karma

andrew_nelson
Communicator

IF you don't need to compare to a lookup with specific indexes, and all you want to return is a list of indexes with no logs in the last 7 days, try run this search over a 30 day window:

| tstats latest(_time) as latestTime where index=* by index
| where latestTime < relative_time(now(), "-7d@d") 
| convert timeformat="%Y/%m/%d" ctime(latestTime)

 

It will only show indexes that have logged in the past 30 days but have stopped more than 7 days ago.

0 Karma

MG
Engager

without using lookup..atleast i need in updated or notupdated fields

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...