Splunk Search

How to use timebased lookup table?

samlinsongguo
Communicator

I defined a lookup table as timebased config in transforms.conf as below

[swipeR.csv]
batch_index_query = 0
case_sensitive_match = 0
filename = swipeR.csv
max_offset_secs = 600
time_field = SwipeTime
time_format = %d/%m/%y %H:%M

however when I try to run following queue

index=main sourcetype="csv" 
|lookup swipeR.csv SwipeTime AS LogonAt OUTPUT Action

it shows me error message

Error in 'lookup' command: You cannot use timefield as a lookup field.
any suggestion on what is may go wrong?
Thanks
Sam

I think it may because I use the time as a lookup field
I change my queue to
index=main sourcetype="csv"
| lookup swipe FullUserName OUTPUT Action
it doesnt return any result, eventhough I am sure there is time match my queue. What is the syntax to use time based lookup? is that different as normal lookup?

Tags (1)
0 Karma

samlinsongguo
Communicator

Found the problem. my lookup table define the time format as

%d/%m/%y %H:%M

but when I open the .csv file from excel it auto changed the time format to

%d/%m/%Y %H:%M

so the lookup table doesn't work. once I edit it in the notepad and change from 2017 to 17 and recreate the lookup table everything work as expected.

0 Karma

hardikJsheth
Motivator

There is no difference in the syntax for the lookup command. However the data returned by lookup command will also take the time in consideration. Try with the time range as per value of SwipeTime

0 Karma
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, ...