Getting Data In

Run external Linux command from within search.

westar
Engager

I need to run a shell script or Linux command inside my search to obtain external Ldap information. I have a UserID that I would like to associate to a full name using a Ldapsearch command passing the UserID from the search.

Tags (2)
1 Solution

the_wolverine
Champion

It can be done:

  • Write a script that queries LDAP for all the required attributes and convert the resultset to a csv file.

  • Configure a lookup for your source or sourcetype to query the csv file to match the userid to CN.

View solution in original post

the_wolverine
Champion

It can be done:

  • Write a script that queries LDAP for all the required attributes and convert the resultset to a csv file.

  • Configure a lookup for your source or sourcetype to query the csv file to match the userid to CN.

gkanapathy
Splunk Employee
Splunk Employee

You can either use a lookup script (follow Lowell's links) or create a custom search command. I would recommend the lookup script, and it sounds like it fits your use case best. An similar alternative that can perform better if you don't require live lookups is to periodically export the data en masse from the LDAP server, write it into a CSV file format into the appropriate location on the Splunk search server, and use a Splunk file lookup against this file.

Lowell
Super Champion

Sounds like you want to use an external lookup script. These have to be written in python, but you can use a simply python script to call the necessary ldap commands (via command line, or via python ldap modules). From there it's a simple matter of writing out a CSV file that contains your new output fields.

Helpful resources:

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