Splunk Search

How to compare and filter results from an inputlookup table?

raby1996
Path Finder

Hi all,

So I have a search that currently is giving me a stats table where one of the fields is "Bundle", and what I've done is created an input lookup table where one of the fields is Bundle Version. Now I have all the fields coming up side by side in the same table, but I want to filter my current bundle field into the Bundle Version field so that only matching Bundle numbers appear in my table while still keeping my other fields that are not part of my CSV file (since some math I'm using relies on the date fields in the Bundle event)

Here is my search, and thank you

|inputlookup Report_lookup.csv | where Release!= "INTERNAL" | dedup "Bundle Version"
| join [search index=* sourcetype=mysearch   
| rex "(?<Bundle>\s+\d+\.\d+\.\d+\.\d+)"
| rex "(?m)Package:\s+SEA.ha(?:\n|.)*?Package Level:\s+(?<LIC>\d+\.\d+\.\d+\.\d+)" 
| rex "(?m)Package:\s+SEA.ha(?:\n|.)*?MS:(?<MS>\s+\d+\-\d+\S\S+)" 
| rex "(?m)Current Bundle.*?(?:\n|.)*?Date:\s+(?<Load_Time>\d+\/\d+/\d+)" 
| eval it = strptime(Load_Time, "%Y/%m/%d") 
| eval ot = strptime(Time, "%Y/%m/%d %I:%M:%S") 
| eval it2 = strftime(it, "%Y/%m/%d") 
| eval ot2 = strftime(ot, "%Y/%m/%d")
| eval it3 = strptime(it2, "%Y/%m/%d")  
| eval ot3 = strptime(ot2, "%Y/%m/%d")
| eval nowstring=strftime(now(), "%Y-%m-%d")
| eval nowstring2=strptime(nowstring, "%Y-%m-%d")
| eval TD= (nowstring2- it3)/86400
| dedup MS, it2 
| sort -Load_Time 
| stats list(LIC) as LIC count list(MTMS) AS MTMS , list(it2) AS Current_Bundle_Date , list(nowstring) AS Search_Date(Today) , list(TD) AS Difference, list(Release) , sum(TD) AS Sum by Bundle
| eval Machine_Months= Sum/30.4
| sort -Bundle]
0 Karma

somesoni2
SplunkTrust
SplunkTrust

Try something like this

index=* sourcetype=mysearch   
 | rex "(?<Bundle>\s+\d+\.\d+\.\d+\.\d+)"
 | rex "(?m)Package:\s+SEA.ha(?:\n|.)*?Package Level:\s+(?<LIC>\d+\.\d+\.\d+\.\d+)" 
 | rex "(?m)Package:\s+SEA.ha(?:\n|.)*?MS:(?<MS>\s+\d+\-\d+\S\S+)" 
 | rex "(?m)Current Bundle.*?(?:\n|.)*?Date:\s+(?<Load_Time>\d+\/\d+/\d+)" 
 | eval it = strptime(Load_Time, "%Y/%m/%d") 
 | eval ot = strptime(Time, "%Y/%m/%d %I:%M:%S") 
 | eval it2 = strftime(it, "%Y/%m/%d") 
 | eval ot2 = strftime(ot, "%Y/%m/%d")
 | eval it3 = strptime(it2, "%Y/%m/%d")  
 | eval ot3 = strptime(ot2, "%Y/%m/%d")
 | eval nowstring=strftime(now(), "%Y-%m-%d")
 | eval nowstring2=strptime(nowstring, "%Y-%m-%d")
 | eval TD= (nowstring2- it3)/86400
 | dedup MS, it2 
 | sort -Load_Time 
 | stats list(LIC) as LIC count list(MTMS) AS MTMS , list(it2) AS Current_Bundle_Date , list(nowstring) AS Search_Date(Today) , list(TD) AS Difference, list(Release) , sum(TD) AS Sum by Bundle
 | eval Machine_Months= Sum/30.4
 | sort -Bundle| lookup Report_lookup.csv "Bundle Version" as Bundle | where Release!= "INTERNAL" 

raby1996
Path Finder

hmmmm, its still not filtering out the Bundles, but still thank you

0 Karma

raby1996
Path Finder

Could it have something to do with the way i have my input set up?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

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 ...