<?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: Unable to index data to splunk using add-on builder modular input method though the event shows in output console in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-index-data-to-splunk-using-add-on-builder-modular/m-p/499132#M194944</link>
    <description>&lt;P&gt;I am trying this one on windows machine. Please let me know if anyone could help on this? One more thing I observed, i set the collect interval as 30 secs in data input section to trigger the script but it's not happening and displays output on console every time I click on test button.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Mar 2020 23:52:02 GMT</pubDate>
    <dc:creator>suryajagarapu</dc:creator>
    <dc:date>2020-03-24T23:52:02Z</dc:date>
    <item>
      <title>Unable to index data to splunk using add-on builder modular input method though the event shows in output console</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-index-data-to-splunk-using-add-on-builder-modular/m-p/499131#M194943</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Event is successfully getting displayed on AOB output console but it is not getting indexed to splunk and it shows 0 events.&lt;/P&gt;

&lt;P&gt;Here is the code:&lt;BR /&gt;
import os&lt;BR /&gt;
import sys&lt;BR /&gt;
import time&lt;BR /&gt;
import datetime&lt;BR /&gt;
import requests&lt;BR /&gt;
import json&lt;BR /&gt;
import splunk&lt;BR /&gt;
import random&lt;/P&gt;

&lt;P&gt;def validate_input(helper, definition):&lt;BR /&gt;
    """Implement your own validation logic to validate the input stanza configurations"""&lt;BR /&gt;
    pass&lt;/P&gt;

&lt;P&gt;def collect_events(helper, ew):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# To create a splunk event
#myindex = service.indexes["test_index"]
data = str(random.randint(0,100))
event_data = {
     "info": data,
     "info2": data
     }
json_data = json.dumps(event_data)   

event = helper.new_event(index=helper.get_output_index(), sourcetype=helper.get_sourcetype(), data=json_data)
try:
     ew.write_event(event)
except Exception as e:
     raise e
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Mar 2020 16:58:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-index-data-to-splunk-using-add-on-builder-modular/m-p/499131#M194943</guid>
      <dc:creator>suryajagarapu</dc:creator>
      <dc:date>2020-03-23T16:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to index data to splunk using add-on builder modular input method though the event shows in output console</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-index-data-to-splunk-using-add-on-builder-modular/m-p/499132#M194944</link>
      <description>&lt;P&gt;I am trying this one on windows machine. Please let me know if anyone could help on this? One more thing I observed, i set the collect interval as 30 secs in data input section to trigger the script but it's not happening and displays output on console every time I click on test button.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 23:52:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-index-data-to-splunk-using-add-on-builder-modular/m-p/499132#M194944</guid>
      <dc:creator>suryajagarapu</dc:creator>
      <dc:date>2020-03-24T23:52:02Z</dc:date>
    </item>
  </channel>
</rss>

