<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Custom Python script not working for splunk eventsI in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384889#M6414</link>
    <description>&lt;P&gt;If python script &lt;CODE&gt;test.py&lt;/CODE&gt; is calling &lt;CODE&gt;$SPLUNK_HOME/etc/apps/search/bin/Catalog_Ext-Akamai.sh&lt;/CODE&gt; then why it's added as scripted input ? &lt;/P&gt;</description>
    <pubDate>Thu, 03 Jan 2019 12:47:43 GMT</pubDate>
    <dc:creator>harsmarvania57</dc:creator>
    <dc:date>2019-01-03T12:47:43Z</dc:date>
    <item>
      <title>Custom Python script not working for splunk eventsI</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384887#M6412</link>
      <description>&lt;P&gt;I have implemented a python script and it is working fine from command prompt and giving output as "200,0.548236". But when I am running my search from splunk dashboard its not showing any results.&lt;/P&gt;

&lt;P&gt;Search command: source="Catalog_Ext-Akamai" earliest=-5m|stats last(StatusCode) as value | rangemap field=value  low=200-200 default=severer|script catalog rel02&lt;/P&gt;

&lt;P&gt;My commands.conf file and inputs.conf file here:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;commands.conf file:&lt;/STRONG&gt;&lt;BR /&gt;
[catalog]&lt;BR /&gt;
filename = test.py&lt;BR /&gt;
type = python&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;inputs.conf file:&lt;/STRONG&gt;&lt;BR /&gt;
[script://$SPLUNK_HOME/etc/apps/search/bin/Catalog_Ext-Akamai.sh] #here we are not passing any args as script running from commands.conf&lt;BR /&gt;
disabled = 0&lt;BR /&gt;
index = kohls_synthetic&lt;BR /&gt;
interval = 300.0&lt;BR /&gt;
sourcetype = synthetic&lt;BR /&gt;
source = Catalog_Ext-Akamai&lt;BR /&gt;
host =&lt;/P&gt;

&lt;P&gt;Can someone help me on this.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/262690-splunk.png" alt="splunk" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:33:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384887#M6412</guid>
      <dc:creator>vijayakrishna</dc:creator>
      <dc:date>2020-09-29T22:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Python script not working for splunk eventsI</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384888#M6413</link>
      <description>&lt;P&gt;My Python script just call my shell script which will run actual code and provide the output.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 10:55:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384888#M6413</guid>
      <dc:creator>vijayakrishna</dc:creator>
      <dc:date>2019-01-03T10:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Python script not working for splunk eventsI</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384889#M6414</link>
      <description>&lt;P&gt;If python script &lt;CODE&gt;test.py&lt;/CODE&gt; is calling &lt;CODE&gt;$SPLUNK_HOME/etc/apps/search/bin/Catalog_Ext-Akamai.sh&lt;/CODE&gt; then why it's added as scripted input ? &lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 12:47:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384889#M6414</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-01-03T12:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Python script not working for splunk eventsI</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384890#M6415</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
We are passing a parameter to shell script and we are unable to pass arguments to inputs.conf file. So implemented a python script to call shell script with arguments. But when we check events, script still picking from inputs.conf instead commands.conf.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 12:54:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384890#M6415</guid>
      <dc:creator>vijayakrishna</dc:creator>
      <dc:date>2019-01-03T12:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Python script not working for splunk eventsI</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384891#M6416</link>
      <description>&lt;P&gt;I am confused, what you want to achieve ? Do you want to run script, based on output generated by splunk query OR Do you want to run scripted input (Scripted input runs at defined interval and index data in Splunk) ?&lt;/P&gt;

&lt;P&gt;If you want to process/send splunk query output then you can use custom command. To create custom command please refer documentation &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.3/Search/Aboutcustomsearchcommands"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.3/Search/Aboutcustomsearchcommands&lt;/A&gt; , Have a look at sample custom command script on this answer &lt;A href="https://answers.splunk.com/answers/601523/custom-command-arguments.html"&gt;https://answers.splunk.com/answers/601523/custom-command-arguments.html&lt;/A&gt; so you will get better idea.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 13:08:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384891#M6416</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-01-03T13:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Python script not working for splunk eventsI</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384892#M6417</link>
      <description>&lt;P&gt;My requirement is simple..&lt;BR /&gt;
I have a dashboard and I want to use the same for multiple environments. So created a dropdown token and passing env as parameter to my shell script.&lt;/P&gt;

&lt;P&gt;I am unable to pass my parameter to shell script which is configured in inputs.conf, so the reason created custom python script in commands.conf and calling shell script using python script.&lt;/P&gt;

&lt;P&gt;Now python script is working fine and giving the output. but when we query through splunk dashboard its not showing any results as events are still looking for script in inputs.conf.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 13:21:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384892#M6417</guid>
      <dc:creator>vijayakrishna</dc:creator>
      <dc:date>2019-01-03T13:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Python script not working for splunk eventsI</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384893#M6418</link>
      <description>&lt;P&gt;"200,0.373956" this is my python script's output. &lt;BR /&gt;
Now I want to run my python script and with arguments and configure 200 as statuscode and 0.373956 as Responsetime and search for the same in search query.&lt;BR /&gt;
 please find my props.conf here.&lt;BR /&gt;
[synthetic]&lt;BR /&gt;
EXTRACT-StatusCode = ^(?P\d+)&lt;BR /&gt;
EXTRACT-ResponseTime = ^\d+:(?P.+)&lt;BR /&gt;
EXTRACT-ResponseTime2,Node = ^\d+,(?P[^ ]+) Node="(?P\d+)&lt;BR /&gt;
EXTRACT-StoreNum = ^(?:[^ \n]* ){5}(?P.+)&lt;BR /&gt;
EXTRACT-ResponseTime2 = ^\d+,(?P[^ ]+)&lt;BR /&gt;
EXTRACT-MemHealth = ^\s+"\w+"\s+:\s+\w+,\s+"\w+"\s+:\s+\w+\s+"\w+"\s+:\s+\w+,\s+"\w+"\s+:\s+\w+,\s+"\w+"\s+:\s+(?P\w+)&lt;BR /&gt;
EXTRACT-CurrentMem = ^\s+"\w+"\s+:\s+"\w+:\s+\w+.\s+\w+:\s+\w+"\s+"\w+"\s+:\s+"\w+\s+\w+"\s+"\w+"\s+:\s+"\w+\s+\w+\s+\d+\s+\w+.\s+\w+\s+\w+\s+(?P[^ ]+)&lt;BR /&gt;
EXTRACT-ResponseTime3 = ^\d+,(?P\d+.\d+)&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 14:23:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384893#M6418</guid>
      <dc:creator>vijayakrishna</dc:creator>
      <dc:date>2019-01-03T14:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Python script not working for splunk eventsI</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384894#M6419</link>
      <description>&lt;P&gt;In your screenshot you have a time range of all time, but in the actual search you include the clause earliest=-5m. &lt;/P&gt;

&lt;P&gt;What is returned if you keep the time range as all time, but change your search to &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=kohls_synthetic source="Catalog_Ext-Akamai"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Dave&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 14:36:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384894#M6419</guid>
      <dc:creator>RHASQaL</dc:creator>
      <dc:date>2019-01-03T14:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Python script not working for splunk eventsI</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384895#M6420</link>
      <description>&lt;P&gt;If we remove script tag from search query its going to inputs.conf file and giving events.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 14:50:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384895#M6420</guid>
      <dc:creator>vijayakrishna</dc:creator>
      <dc:date>2019-01-03T14:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Python script not working for splunk eventsI</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384896#M6421</link>
      <description>&lt;P&gt;how can we avoid script to go inputs.conf and should go to commands.conf always.&lt;BR /&gt;
In my case for events it is picking the script from inputs.conf instead of commands.conf&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 14:52:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384896#M6421</guid>
      <dc:creator>vijayakrishna</dc:creator>
      <dc:date>2019-01-03T14:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Python script not working for splunk eventsI</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384897#M6422</link>
      <description>&lt;P&gt;File not found /tmp/splunk/etc/apps/search/bin/.properties -- this is the output as script is expecting the argument from script that is the reason its saying file not found ".properties".&lt;/P&gt;

&lt;P&gt;If we pass or hardcode some value for parameter it will work.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 15:10:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384897#M6422</guid>
      <dc:creator>vijayakrishna</dc:creator>
      <dc:date>2019-01-03T15:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Python script not working for splunk eventsI</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384898#M6423</link>
      <description>&lt;P&gt;How about a different solution? If you just want to pass the 'env' to script [ say prod, test, dev], you can  run something similar to |rest /services/server/roles  splunk_server=local| search splunk_server=*  { assuming you have diff Search head for prod/test etc..} you can have a lookup with your SH details classified as dev/prod/test. when the dashboard loads, it can give you the 'env' variable which you can pass to your script.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:36:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-Python-script-not-working-for-splunk-eventsI/m-p/384898#M6423</guid>
      <dc:creator>lakshman239</dc:creator>
      <dc:date>2020-09-29T22:36:36Z</dc:date>
    </item>
  </channel>
</rss>

