<?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 New field/attribute added to raw results by python in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/New-field-attribute-added-to-raw-results-by-python/m-p/43287#M10191</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I am trying to add a new field to my search results via a custom search command written in python&lt;/P&gt;

&lt;P&gt;Take the following snippet from the script:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;results,results1,results2 = splunk.Intersplunk.getOrganizedResults()

for line in results:

line["Test"] = 'Some Test Text'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I run a search which uses this custom search command I don't see the Test field appearing in the events list, events table or results table. Just wondering if my expectation is incorrect in terms of Splunk being able to do this&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Matt &lt;/P&gt;</description>
    <pubDate>Fri, 04 May 2012 10:20:50 GMT</pubDate>
    <dc:creator>MatthewTowey</dc:creator>
    <dc:date>2012-05-04T10:20:50Z</dc:date>
    <item>
      <title>New field/attribute added to raw results by python</title>
      <link>https://community.splunk.com/t5/Splunk-Search/New-field-attribute-added-to-raw-results-by-python/m-p/43287#M10191</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I am trying to add a new field to my search results via a custom search command written in python&lt;/P&gt;

&lt;P&gt;Take the following snippet from the script:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;results,results1,results2 = splunk.Intersplunk.getOrganizedResults()

for line in results:

line["Test"] = 'Some Test Text'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I run a search which uses this custom search command I don't see the Test field appearing in the events list, events table or results table. Just wondering if my expectation is incorrect in terms of Splunk being able to do this&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Matt &lt;/P&gt;</description>
      <pubDate>Fri, 04 May 2012 10:20:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/New-field-attribute-added-to-raw-results-by-python/m-p/43287#M10191</guid>
      <dc:creator>MatthewTowey</dc:creator>
      <dc:date>2012-05-04T10:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: New field/attribute added to raw results by python</title>
      <link>https://community.splunk.com/t5/Splunk-Search/New-field-attribute-added-to-raw-results-by-python/m-p/43288#M10192</link>
      <description>&lt;P&gt;You have to output the results after the loop (ie. once you've modified them).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;splunk.Intersplunk.outputResults(results)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 May 2012 10:26:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/New-field-attribute-added-to-raw-results-by-python/m-p/43288#M10192</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-05-04T10:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: New field/attribute added to raw results by python</title>
      <link>https://community.splunk.com/t5/Splunk-Search/New-field-attribute-added-to-raw-results-by-python/m-p/43289#M10193</link>
      <description>&lt;P&gt;Hi ziegfried &lt;BR /&gt;
Thanks for the reply &lt;BR /&gt;
Sorry I hadn't included more of the code to make it more clear.&lt;BR /&gt;
I have the " splunk.Intersplunk.outputResults(results)"&lt;BR /&gt;
line of code after the loop finishes.&lt;/P&gt;</description>
      <pubDate>Fri, 04 May 2012 11:20:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/New-field-attribute-added-to-raw-results-by-python/m-p/43289#M10193</guid>
      <dc:creator>MatthewTowey</dc:creator>
      <dc:date>2012-05-04T11:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: New field/attribute added to raw results by python</title>
      <link>https://community.splunk.com/t5/Splunk-Search/New-field-attribute-added-to-raw-results-by-python/m-p/43290#M10194</link>
      <description>&lt;P&gt;I see. The field should be available in the results then. What's the exact search, you're using? Is the field selected (ie. does it appear in the field picker - on the left)?&lt;/P&gt;</description>
      <pubDate>Fri, 04 May 2012 11:39:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/New-field-attribute-added-to-raw-results-by-python/m-p/43290#M10194</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-05-04T11:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: New field/attribute added to raw results by python</title>
      <link>https://community.splunk.com/t5/Splunk-Search/New-field-attribute-added-to-raw-results-by-python/m-p/43291#M10195</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
I am using the following search: source="file-name.txt" |&lt;CUSTOM-SEARCH-CMD&gt; | head 2. The field does not appear in the field picker&lt;/CUSTOM-SEARCH-CMD&gt;&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Matt&lt;/P&gt;</description>
      <pubDate>Fri, 04 May 2012 13:25:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/New-field-attribute-added-to-raw-results-by-python/m-p/43291#M10195</guid>
      <dc:creator>MatthewTowey</dc:creator>
      <dc:date>2012-05-04T13:25:16Z</dc:date>
    </item>
  </channel>
</rss>

