Getting Data In

Lookups with a python script

Marinus
Communicator

The transforms spec indicated that you can do a lookup using a python script. Do you have an example?

Tags (1)
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

There is an example in $SPLUNK_HOME/etc/system/bin/external_lookup.py.

View solution in original post

bansi
Path Finder

I think if someone has already developed similar article to connect to DB2 database and lookup table at search time then please publish it otherwise i am working on it and will be glad to publish it if i get little help from Splunk Forums on how to integrate my working copy under Python 2.7 with Splunk Python 2.6

0 Karma

Lowell
Super Champion

For anyone interested in a database lookup script example, I have posted one here:

gkanapathy
Splunk Employee
Splunk Employee

There is an example in $SPLUNK_HOME/etc/system/bin/external_lookup.py.

gkanapathy
Splunk Employee
Splunk Employee

Not really, but it's the same. All you do is add another column to the output CSV and add the extra field in the appropriate places in the configuration. Basically, Splunk passes a CSV file in to the script, with lookup values in the input columns/fields and null values in the output columns/fields, and your script should write out a CSV with all the fields filled in.

0 Karma

Marinus
Communicator

Thanks Gerald, do you have an example if you want to return more than one field based on your lookup?

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...