Splunk Search

Search result value as an argument to perl script

disha
Contributor

Hi,
I am invoking perl script with script command in search, which needs to take search result field as an argument to the script.
|inputcsv model.txt|table str
this is giving
name=ABC,input=5,output=6
I need to pass this value as string parameter to script as
script perl tcpclient name=ABC,input=5,output=6

so i am executing
|inputcsv model.txt|table str|script perl tcpclient str

but I am getting as "str" not the value.
if i hard code it like
|inputcsv model.txt|table str|script perl tcpclient name=ABC,input=5,output=6
I am getting it properly.
Can you please help me how I can use the value of "str" other than "str" as I cannot hardcode it. I need to read csv and need to pass the value of str as an argument to perl script.
Please suggest. This is very urgent.:(
Thanks,
Disha

Tags (1)
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

You could register your python script as a custom command, and use splunk.Intersplunk to retrieve search results.

0 Karma

disha
Contributor

Yes Vincesesto,
I have tried just "name" also inplace of str and also try the python script instead of Perl.Till now it seems like script can only invoke the perl/python script with hardcoded input arguments. Please suggest.
Thanks,
Disha

0 Karma

vincesesto
Communicator

Hi disha, probably a silly question, but have you tried to separate each of the fields instead of including them in one string, eg; instead of str, have the fields name, input, output...just a suggestion

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