<?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 to write and execute python script for XML file ? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-write-and-execute-python-script-for-XML-file/m-p/188059#M2525</link>
    <description>&lt;P&gt;You can write python script, but I wouldn't tie it to Splunk Index process. You need to tie it to the Process/script which puts the file in there.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jul 2015 14:35:31 GMT</pubDate>
    <dc:creator>koshyk</dc:creator>
    <dc:date>2015-07-01T14:35:31Z</dc:date>
    <item>
      <title>How to write and execute python script for XML file ?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-write-and-execute-python-script-for-XML-file/m-p/188057#M2523</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I have to monitor a directory which contains XML file. &lt;BR /&gt;
I need to add an additional &amp;lt;tag&amp;gt; in xml file whenever a new file comes and before file is indexed by splunk.&lt;BR /&gt;
i.e. whenever a file come a script should be run that add a &amp;lt;tag&amp;gt;. Then after it is indexed.&lt;BR /&gt;
How can achieve through python script?&lt;BR /&gt;
Is anything required to install to run the script?&lt;/P&gt;

&lt;P&gt;XML File look like :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
    &amp;lt;presentation&amp;gt;
      &amp;lt;lesson&amp;gt;
        &amp;lt;part src="0301p.flv" breadcrumb="This is example text1"&amp;gt;
          &amp;lt;cuepoints&amp;gt;
            &amp;lt;cuepoint time="0:01" preload="priority" tooltip="Demo 3.1(A)" jumpable="yes"&amp;gt;
              &amp;lt;tween mode="instant" time="1" /&amp;gt;
              &amp;lt;slide flv="demos/0301d1.flv" demooffsetx="-180" demooffsety="60" type="demo"&amp;gt;&amp;lt;/slide&amp;gt;
              &amp;lt;presenter /&amp;gt;
              &amp;lt;controls /&amp;gt;
            &amp;lt;/cuepoint&amp;gt;
          &amp;lt;/cuepoints&amp;gt;
         &amp;lt;/part&amp;gt;
       &amp;lt;/lesson&amp;gt;
    &amp;lt;/presentation&amp;gt;

      I need to add  &amp;lt;date&amp;gt;...&amp;lt;/date&amp;gt; just below &amp;lt;presentation&amp;gt; tag.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have no idea how  will i proceed?&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Aditya&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2015 11:25:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-write-and-execute-python-script-for-XML-file/m-p/188057#M2523</guid>
      <dc:creator>adityaanand</dc:creator>
      <dc:date>2015-07-01T11:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to write and execute python script for XML file ?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-write-and-execute-python-script-for-XML-file/m-p/188058#M2524</link>
      <description>&lt;P&gt;Writing the script is straightforward.  Create it as you would any stand-alone python program with the understanding that everything written to stdout will be indexed by Splunk.  You could have the script read a file line-by-line and write the lines to stdout with your extra line added at the proper place.&lt;/P&gt;

&lt;P&gt;I don't know how to have the script execute whenever a new file arrives.  The best I can think of is to create a scripted input that runs at some interval and have the script search for new files that have arrived since the last interval.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2015 13:47:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-write-and-execute-python-script-for-XML-file/m-p/188058#M2524</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-07-01T13:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to write and execute python script for XML file ?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-write-and-execute-python-script-for-XML-file/m-p/188059#M2525</link>
      <description>&lt;P&gt;You can write python script, but I wouldn't tie it to Splunk Index process. You need to tie it to the Process/script which puts the file in there.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2015 14:35:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-write-and-execute-python-script-for-XML-file/m-p/188059#M2525</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2015-07-01T14:35:31Z</dc:date>
    </item>
  </channel>
</rss>

