<?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: external script in commands.conf to create key/value pair in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/external-script-in-commands-conf-to-create-key-value-pair/m-p/248222#M47833</link>
    <description>&lt;P&gt;what is the actual name of the field that contains output?  It can't actually be "unnamed".  whatever the name is, you can copy it into _raw via eval&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval _raw = your_field_name
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 01 Oct 2015 18:51:03 GMT</pubDate>
    <dc:creator>steveyz</dc:creator>
    <dc:date>2015-10-01T18:51:03Z</dc:date>
    <item>
      <title>external script in commands.conf to create key/value pair</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/external-script-in-commands-conf-to-create-key-value-pair/m-p/248219#M47830</link>
      <description>&lt;P&gt;I've created a script that, when called from the search bar using:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|script foo.py | outputtext
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;it outputs a table containing one unnamed column containing the script output and an empty _raw column.&lt;BR /&gt;
If the output is "key=value", is there a downstream command I can use that will actually create that field and value?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2015 21:30:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/external-script-in-commands-conf-to-create-key-value-pair/m-p/248219#M47830</guid>
      <dc:creator>pkeller</dc:creator>
      <dc:date>2015-09-30T21:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: external script in commands.conf to create key/value pair</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/external-script-in-commands-conf-to-create-key-value-pair/m-p/248220#M47831</link>
      <description>&lt;P&gt;you can probably use the extract/kv command, something along the lines of&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | kv kvdelim="=" pairdelim=" "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that is assuming that if you have multiple key-value pairs they are seperated by space. &lt;/P&gt;

&lt;P&gt;see &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.0/SearchReference/Extract"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.0/SearchReference/Extract&lt;/A&gt; for more details.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2015 22:57:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/external-script-in-commands-conf-to-create-key-value-pair/m-p/248220#M47831</guid>
      <dc:creator>steveyz</dc:creator>
      <dc:date>2015-09-30T22:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: external script in commands.conf to create key/value pair</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/external-script-in-commands-conf-to-create-key-value-pair/m-p/248221#M47832</link>
      <description>&lt;P&gt;The kv command didn't quite work for me, as the output isn't part of _raw  ... outputtext prints the output as its own field header ... But, if I modify the script to produce two unique lines of output ...&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;key&lt;/LI&gt;
&lt;LI&gt;value&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Then, the splunk output creates a field named key and with the contents of the 2nd line of output as the value. That works well for my needs. &lt;/P&gt;

&lt;P&gt;The only issue would be why Splunk is producing 2 rows containing null values. ( I can remedy that using | search value!="" )&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 18:34:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/external-script-in-commands-conf-to-create-key-value-pair/m-p/248221#M47832</guid>
      <dc:creator>pkeller</dc:creator>
      <dc:date>2015-10-01T18:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: external script in commands.conf to create key/value pair</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/external-script-in-commands-conf-to-create-key-value-pair/m-p/248222#M47833</link>
      <description>&lt;P&gt;what is the actual name of the field that contains output?  It can't actually be "unnamed".  whatever the name is, you can copy it into _raw via eval&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval _raw = your_field_name
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Oct 2015 18:51:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/external-script-in-commands-conf-to-create-key-value-pair/m-p/248222#M47833</guid>
      <dc:creator>steveyz</dc:creator>
      <dc:date>2015-10-01T18:51:03Z</dc:date>
    </item>
  </channel>
</rss>

