<?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: How do you run a Python script on (or before) an index? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425626#M7577</link>
    <description>&lt;P&gt;Hi, I have a similar requirement where I want to intercept the event and want to modify the value of a field which will again come from a REST call.  Basically I want to execute a script before sending the fields to index. I am getting data through HTTP Event Collector. Is this possible to do in Splunk?&lt;/P&gt;</description>
    <pubDate>Tue, 10 Dec 2019 10:12:11 GMT</pubDate>
    <dc:creator>rameshprasad</dc:creator>
    <dc:date>2019-12-10T10:12:11Z</dc:date>
    <item>
      <title>How do you run a Python script on (or before) an index?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425620#M7571</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Is it possible to create a custom app on Splunk so that will run a Python script on a custom source (or sourcetype) before a new item is indexed? Specifically, I would also like to access the data that is incoming.&lt;/P&gt;
&lt;P&gt;Suppose I have this event coming into splunk:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;eventName=newUser firstName=henry lastName=adams
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I would like to intercept it and then perhaps add fullName="henry adams"&lt;/P&gt;
&lt;P&gt;PS: on my use case, I have to do the processing on/before index, so I cannot use real time alerts.&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jun 2020 18:38:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425620#M7571</guid>
      <dc:creator>agro1986001</dc:creator>
      <dc:date>2020-06-07T18:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do you run a Python script on (or before) an index?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425621#M7572</link>
      <description>&lt;P&gt;Hello @agro1986001 &lt;BR /&gt;
I think the below example can be achieved using props and transform using regex &lt;/P&gt;

&lt;P&gt;In Splunk using regex, you can replace the data inside the event. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.3/Data/Configureindex-timefieldextraction" target="test_blank"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.3/Data/Configureindex-timefieldextraction&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Jan 2019 13:26:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425621#M7572</guid>
      <dc:creator>vishaltaneja070</dc:creator>
      <dc:date>2019-01-23T13:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do you run a Python script on (or before) an index?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425622#M7573</link>
      <description>&lt;P&gt;Hi @vishaltaneja07011993 &lt;/P&gt;

&lt;P&gt;I gave a simple example of reading data, but unfortunately what I'm doing is not just that. Let's say for example that my python script wants to write to a database (mysql, redis, etc.), which cannot be done using just splunk (only an example. the point is I really want a python script to be called). I want to know whether it's technically possible or not.&lt;/P&gt;

&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 13:34:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425622#M7573</guid>
      <dc:creator>agro1986001</dc:creator>
      <dc:date>2019-01-23T13:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do you run a Python script on (or before) an index?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425623#M7574</link>
      <description>&lt;P&gt;@agro1986001 &lt;/P&gt;

&lt;P&gt;Okay. Yes you can call python script through splunk using inputs.conf. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.3/AdvancedDev/ScriptedInputsIntro" target="test_blank"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.3/AdvancedDev/ScriptedInputsIntro&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And secondly, if we forward data to database from Splunk, you can relay on db connect as well. &lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 13:37:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425623#M7574</guid>
      <dc:creator>vishaltaneja070</dc:creator>
      <dc:date>2019-01-23T13:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do you run a Python script on (or before) an index?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425624#M7575</link>
      <description>&lt;P&gt;Thanks, but that's different than what I want to accomplish.&lt;/P&gt;

&lt;P&gt;I'm not trying to make a script that inputs data to splunk.&lt;/P&gt;

&lt;P&gt;I already have data flowing into splunk. I just want a script to be called for every event before that event gets indexed.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 13:46:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425624#M7575</guid>
      <dc:creator>agro1986001</dc:creator>
      <dc:date>2019-01-23T13:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do you run a Python script on (or before) an index?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425625#M7576</link>
      <description>&lt;P&gt;@agro1986001 &lt;/P&gt;

&lt;P&gt;Sorry that doesn't seem to feasible using Splunk.&lt;/P&gt;

&lt;P&gt;After indexing, i think still it is possible if you save it as alert but not before indexing.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 13:57:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425625#M7576</guid>
      <dc:creator>vishaltaneja070</dc:creator>
      <dc:date>2019-01-23T13:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do you run a Python script on (or before) an index?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425626#M7577</link>
      <description>&lt;P&gt;Hi, I have a similar requirement where I want to intercept the event and want to modify the value of a field which will again come from a REST call.  Basically I want to execute a script before sending the fields to index. I am getting data through HTTP Event Collector. Is this possible to do in Splunk?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 10:12:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-run-a-Python-script-on-or-before-an-index/m-p/425626#M7577</guid>
      <dc:creator>rameshprasad</dc:creator>
      <dc:date>2019-12-10T10:12:11Z</dc:date>
    </item>
  </channel>
</rss>

