Splunk Dev

How to pass parameters in custom search command?

rajacybermak
Explorer

I am trying out custom search command.
I have in commands.conf the below

[createrecord1]
chunked = true
filename = myjava.path
command.arg.1 = -jar
command.arg.2 = splunkcreaterecord1.jar

I would like to know how to pass argument values from search
eg if I type |createrecord1 **100**
it execute " java -jar splunkcreaterecord.jar" without the parameter

I would like the jar file to be executed as java -jar splunkcreaterecord.jar **100**

Kindly assist

0 Karma

woodcock
Esteemed Legend

Define it like this:

 [createrecord1]
 chunked = true
 filename = myjava.path
 command.arg.1 = jar

Then use it like this:

... | createrecord1 jar "splunkcreaterecord1.jar"
0 Karma

p_gurav
Champion

Can you try to pass argument in double quotes ""?

0 Karma

rajacybermak
Explorer

Thanks Gaurav for the reply.
Could you kindly elaborate

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...