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.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...