<?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: discard few fields and ingest required data using scripted input in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422838#M74252</link>
    <description>&lt;P&gt;Thanks @richgalloway I will give this try and will keep posted.&lt;/P&gt;</description>
    <pubDate>Mon, 17 Jun 2019 09:14:24 GMT</pubDate>
    <dc:creator>ips_mandar</dc:creator>
    <dc:date>2019-06-17T09:14:24Z</dc:date>
    <item>
      <title>discard few fields and ingest required data using scripted input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422832#M74246</link>
      <description>&lt;P&gt;I want to discard few fields from monitoring input so not increase license usage&lt;BR /&gt;
What will be best way to do it &lt;BR /&gt;
It can be possible with SEDCMD but I am trying to know using scripted input&lt;BR /&gt;
I am newbie in script writing ..can anyone guide me to write python script to take only required data in splunk.&lt;BR /&gt;
What are the stepsto follow?&lt;BR /&gt;
Thanks in advance. I am using Splunk 7.3 on Windows server.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 10:41:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422832#M74246</guid>
      <dc:creator>ips_mandar</dc:creator>
      <dc:date>2019-06-14T10:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: discard few fields and ingest required data using scripted input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422833#M74247</link>
      <description>&lt;P&gt;Splunk will index whatever a scripted input writes to stdout.  Your script can read any data at all, but the key is &lt;EM&gt;write only the fields you want in Splunk&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 12:20:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422833#M74247</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-06-14T12:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: discard few fields and ingest required data using scripted input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422834#M74248</link>
      <description>&lt;P&gt;Thanks @richgalloway Can you please help me with sample script like python . for example I have csv file in which I want only field 2 ,field 3 ,field 5 to be extracted... Since I never written any script can you please help to  provide sample script which will work like mentioned above.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 13:47:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422834#M74248</guid>
      <dc:creator>ips_mandar</dc:creator>
      <dc:date>2019-06-14T13:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: discard few fields and ingest required data using scripted input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422835#M74249</link>
      <description>&lt;P&gt;Google can provide lots of examples.  Here's one I crafted from the first result.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import csv

with open('my_csv.txt', mode='r') as csv_file:
    csv_reader = csv.DictReader(csv_file)
    for row in csv_reader:
        print(f'{row[2]},{row[3]},{row[5]}')
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Jun 2019 14:28:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422835#M74249</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-06-14T14:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: discard few fields and ingest required data using scripted input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422836#M74250</link>
      <description>&lt;P&gt;If you are using a scripted input, then you can either edit the script to modify what it outputs, or, if you already have a &lt;CODE&gt;SEDCMD&lt;/CODE&gt; that works, you can just add &lt;CODE&gt;| sed "Your SEDCMD here"&lt;/CODE&gt; to the end of the command line.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 16:51:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422836#M74250</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-14T16:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: discard few fields and ingest required data using scripted input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422837#M74251</link>
      <description>&lt;P&gt;Thanks @woodcock &lt;BR /&gt;
For example I have below props.conf &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-aremoveheader = s/^\&amp;lt;\?xml[^\&amp;gt;]*\&amp;gt;\n*//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then What I need to write in script to run above in script(will it by &lt;CODE&gt;.py&lt;/CODE&gt;?). &lt;BR /&gt;
Note: the above props.conf is in Indexer and if I run only &lt;CODE&gt;|sed ""&lt;/CODE&gt;using script it will not fetch the data from remote server. Since I want to fetch data from remote server.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 09:13:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422837#M74251</guid>
      <dc:creator>ips_mandar</dc:creator>
      <dc:date>2019-06-17T09:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: discard few fields and ingest required data using scripted input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422838#M74252</link>
      <description>&lt;P&gt;Thanks @richgalloway I will give this try and will keep posted.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 09:14:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422838#M74252</guid>
      <dc:creator>ips_mandar</dc:creator>
      <dc:date>2019-06-17T09:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: discard few fields and ingest required data using scripted input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422839#M74253</link>
      <description>&lt;P&gt;You have something like this in your inputs.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [script:///path/to/your_script.sh]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Change it to this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[script:///path/to/your_script.sh | sed "s/^\&amp;lt;\?xml[^\&amp;gt;]*\&amp;gt;\n*//g"]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Jun 2019 13:40:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422839#M74253</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-17T13:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: discard few fields and ingest required data using scripted input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422840#M74254</link>
      <description>&lt;P&gt;You might need to specify the full path to the &lt;CODE&gt;sed&lt;/CODE&gt; binary.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 16:48:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/discard-few-fields-and-ingest-required-data-using-scripted-input/m-p/422840#M74254</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-17T16:48:18Z</dc:date>
    </item>
  </channel>
</rss>

