<?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 GeneratingCommand intended behaviour? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/GeneratingCommand-intended-behaviour/m-p/396259#M70640</link>
    <description>&lt;P&gt;I've been writing custom commands using SCP1, particularly using splunk.Intersplunk.outputStreamResults and it's been great to use. To give some context, the command hits an API that exposes JSON which ultimately ends up in Splunk. However, I've been wanting to make use of SCP2's GeneratingCommand class to take advantage of getting the earliest &amp;amp; latest start times from a Splunk search.&lt;/P&gt;

&lt;P&gt;I've been testing  SCP2 and the GeneratingCommand class but am noticing some strange behaviour, especially when viewing the events in Splunk. This might be intended, but I just wanted to see if anyone else has come across similar and perhaps point me in the correct direction ?&lt;/P&gt;

&lt;P&gt;I'm using:&lt;BR /&gt;
- python-sdk-1.6.4&lt;BR /&gt;
- Splunk 6.6.3&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;for x in range(10):
        row = {}
        row['field_1'] = ['apple', 'orange']

        if x % 2 == 0:
                row['field_2'] = ['grape', 'melon']
        else:
                row['field_3'] = ['pear', 'apricot']

        row['_time'] = time.time()
        row['_raw'] = str(row)

        yield row
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5241iB98D5C4480250697/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;So my question is, why is field_3 missing?&lt;/P&gt;

&lt;P&gt;If I make the following changes to the snippet, then all 3 fields are extracted by Splunk.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;for x in range(10):
        row = {}
        row['field_1'] = ['apple', 'orange']

        if x % 2 == 0:
                row['field_2'] = ['grape', 'melon']
                row['field_3'] = ['']
        else:
                row['field_3'] = ['pear', 'apricot']
                row['field_2'] = ['']

        row['_time'] = time.time()
        row['_raw'] = str(row)

        yield row
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;Any help or pointers would be most appreciated!&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jun 2018 11:53:31 GMT</pubDate>
    <dc:creator>stephenmcglade</dc:creator>
    <dc:date>2018-06-19T11:53:31Z</dc:date>
    <item>
      <title>GeneratingCommand intended behaviour?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/GeneratingCommand-intended-behaviour/m-p/396259#M70640</link>
      <description>&lt;P&gt;I've been writing custom commands using SCP1, particularly using splunk.Intersplunk.outputStreamResults and it's been great to use. To give some context, the command hits an API that exposes JSON which ultimately ends up in Splunk. However, I've been wanting to make use of SCP2's GeneratingCommand class to take advantage of getting the earliest &amp;amp; latest start times from a Splunk search.&lt;/P&gt;

&lt;P&gt;I've been testing  SCP2 and the GeneratingCommand class but am noticing some strange behaviour, especially when viewing the events in Splunk. This might be intended, but I just wanted to see if anyone else has come across similar and perhaps point me in the correct direction ?&lt;/P&gt;

&lt;P&gt;I'm using:&lt;BR /&gt;
- python-sdk-1.6.4&lt;BR /&gt;
- Splunk 6.6.3&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;for x in range(10):
        row = {}
        row['field_1'] = ['apple', 'orange']

        if x % 2 == 0:
                row['field_2'] = ['grape', 'melon']
        else:
                row['field_3'] = ['pear', 'apricot']

        row['_time'] = time.time()
        row['_raw'] = str(row)

        yield row
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5241iB98D5C4480250697/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;So my question is, why is field_3 missing?&lt;/P&gt;

&lt;P&gt;If I make the following changes to the snippet, then all 3 fields are extracted by Splunk.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;for x in range(10):
        row = {}
        row['field_1'] = ['apple', 'orange']

        if x % 2 == 0:
                row['field_2'] = ['grape', 'melon']
                row['field_3'] = ['']
        else:
                row['field_3'] = ['pear', 'apricot']
                row['field_2'] = ['']

        row['_time'] = time.time()
        row['_raw'] = str(row)

        yield row
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;Any help or pointers would be most appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 11:53:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/GeneratingCommand-intended-behaviour/m-p/396259#M70640</guid>
      <dc:creator>stephenmcglade</dc:creator>
      <dc:date>2018-06-19T11:53:31Z</dc:date>
    </item>
  </channel>
</rss>

