Splunk Search

Search two fields in one csv lookup

ocampocliff1
Engager

I want to use fields two fields that i have inside the lookup,

Inside my lookup i have "account" and "date"

basically i want to do is to search the account with the date which is greater than today.

Tags (1)
0 Karma

adonio
Ultra Champion

alt text

alt text

0 Karma

adonio
Ultra Champion

Hello ocampocliff1,
here is the csv i created:
alt text

if the date format is different on your end, you will have to change the time format in the eval statements. you can find the formats here: https://docs.splunk.com/Documentation/Splunk/6.5.2/SearchReference/Commontimeformatvariables

using this search:

| inputlookup accounts.csv 
 | eval new_time = strptime(date, "%m/%d/%Y") 
 | eval c_time=strftime(new_time,"%m/%d/%y %H:%M:%S") 
 | eval now = now() 
 | where new_time > now 
 | table account, c_time 

i got this:

alt text

you can play with the | where clause as you please to find accounts on a time frame

Hope it helps

adonio
Ultra Champion

couldn't edit the answer to show screenshots. they are in the answer below

0 Karma

ocampocliff1
Engager

Hi adonio,

Thanks for this one!

I'm using this concept now. 🙂

0 Karma

adonio
Ultra Champion

you are welcome!
if that answers, can you mark as "answered"?
thanks!

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...