I'm currently trying to create a custom command to handle a multivalue lookup without having to run
|mvexpand
Using MVexpand on large records with multivalue fields will multiply the number of rows and can be unwieldy if we have to use this logic on multiple multivalue fields.
The hope is for a custom command logic to do the following:
1. pull in a lookup file,
2. loop through each record, for each multivalue field
3. --loop through each multivalue field and apply the lookup.
In regards to Splunk custom command coding, what's the guideline for accessing input lookup files? Its mentioned on the python-SDK main page, but then there's no mention of it in the python SDK reference site. for any input file, do we need to add a code to check 4-5 different locations to see if such a file exists? If this is the route, is there a proper order to check the file, for example, check systems/lookup first then local app/bin/lookup then user lookup directory?
Ideally, it would be great if we can make the same call that the system is using when you run |lookup command and |inputloookup command.
http://dev.splunk.com/view/python-sdk/SP-CAAAEU2
GeneratingCommand: Generates event records based on command arguments. Examples of generating commands include search (at the beginning of the pipeline), inputcsv, input lookup, and metadata.
python SDK reference site
https://docs.splunk.com/DocumentationStatic/PythonSDK/1.6.5/index.html#searchcommands
location of CSV files >> In addition to the directory noted here, i've noticed lookup files are also placed here: /opt/splunk/etc/users/{user-account}/{splunk-app}/lookups/
https://docs.splunk.com/Documentation/Splunk/7.2.4/Knowledge/ConfigureCSVlookups
if you offer any code that will help resolve, i'll be happy to offer my karma points.
Other simiilar questions. that i've reviewed and have found helpful so far:
https://answers.splunk.com/answers/145561/how-to-script-a-lookup-in-python.html
https://answers.splunk.com/answers/177608/how-to-call-an-external-python-script-to-populate.html
https://answers.splunk.com/answers/106284/python-wrapper-for-external-command-lookup-doesnt-properly...
https://answers.splunk.com/answers/26939/how-do-i-add-a-python-module-for-external-lookup-command.ht... >> Use of wrapper seems promising.
https://answers.splunk.com/answers/10463/example-of-doing-an-external-lookup-using-http-get-or-post....