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!

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...

Updated Data Management and AWS GDI Inventory in Splunk Observability

We’re making some changes to Data Management and Infrastructure Inventory for AWS. The Data Management page, ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...