<?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 Custom Command does not provide all fields from REST in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Command-does-not-provide-all-fields-from-REST/m-p/574790#M10194</link>
    <description>&lt;P&gt;I created a Custom Command to generate Events from a REST-API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[cmdb]
filename = cmdb.py
generating = true
chunked = true
supports_multivalues = true&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Command runs. The problem is that there are different field sets per Host, where I'm looping through.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I only get the fields where all the hosts have an entry.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;TABLE border="1" width="39.06373058627099%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Host&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Field a&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Field b&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;foo&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Value&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;foobar&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Value&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;bar&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Value&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;fbar&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Value&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Field b will not show up in the Splunk Results List.&lt;/P&gt;&lt;P&gt;Code sample. I add the patch report only to those hosts, which have on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if len(sorted_patch_report) &amp;gt; 0:
                     sorted_patch_report = (sorted_patch_report[0])

                     sorted_patch_report_renamed = {"Patching_" + str(key): val for key, val in sorted_patch_report.items()}

                     i.update(sorted_patch_report_renamed)
                     #self.logger.fatal(i)

                     yield dict(i)

                 else:
                 #except IndexError:
                      #sorted_patch_report = 'null'
                      self.logger.info("No patch report for "+i['fullQualifiedDomainName'])

                      #self.logger.fatal(i)
                      yield dict(i)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I print the dict to logger I see all the fields.&lt;/P&gt;&lt;P&gt;Any Idea?&lt;/P&gt;</description>
    <pubDate>Fri, 12 Nov 2021 20:52:25 GMT</pubDate>
    <dc:creator>benlc</dc:creator>
    <dc:date>2021-11-12T20:52:25Z</dc:date>
    <item>
      <title>Custom Command does not provide all fields from REST</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Command-does-not-provide-all-fields-from-REST/m-p/574790#M10194</link>
      <description>&lt;P&gt;I created a Custom Command to generate Events from a REST-API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[cmdb]
filename = cmdb.py
generating = true
chunked = true
supports_multivalues = true&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Command runs. The problem is that there are different field sets per Host, where I'm looping through.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I only get the fields where all the hosts have an entry.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;TABLE border="1" width="39.06373058627099%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Host&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Field a&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Field b&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;foo&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Value&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;foobar&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Value&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;bar&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Value&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;fbar&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Value&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Field b will not show up in the Splunk Results List.&lt;/P&gt;&lt;P&gt;Code sample. I add the patch report only to those hosts, which have on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if len(sorted_patch_report) &amp;gt; 0:
                     sorted_patch_report = (sorted_patch_report[0])

                     sorted_patch_report_renamed = {"Patching_" + str(key): val for key, val in sorted_patch_report.items()}

                     i.update(sorted_patch_report_renamed)
                     #self.logger.fatal(i)

                     yield dict(i)

                 else:
                 #except IndexError:
                      #sorted_patch_report = 'null'
                      self.logger.info("No patch report for "+i['fullQualifiedDomainName'])

                      #self.logger.fatal(i)
                      yield dict(i)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I print the dict to logger I see all the fields.&lt;/P&gt;&lt;P&gt;Any Idea?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 20:52:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-Command-does-not-provide-all-fields-from-REST/m-p/574790#M10194</guid>
      <dc:creator>benlc</dc:creator>
      <dc:date>2021-11-12T20:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Command does not provide all fields from REST</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-Command-does-not-provide-all-fields-from-REST/m-p/576216#M10195</link>
      <description>&lt;P&gt;Thanks for reporting this, we believe the issue has been addressed in version 1.6.18 of the Python SDK. After some discussion with the community on how to release the fix the consensus was to allow developers to opt-in to the fix (see&amp;nbsp;&lt;A href="https://github.com/splunk/splunk-sdk-python/issues/401" target="_blank" rel="noopener"&gt;https://github.com/splunk/splunk-sdk-python/issues/401&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;Here's more details on how to opt-in to the fix by calling&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;self&lt;/SPAN&gt;.&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;add_field&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;within the search command: &lt;A href="https://github.com/splunk/splunk-sdk-python#customization" target="_blank" rel="noopener"&gt;https://github.com/splunk/splunk-sdk-python#customization&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 16:32:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-Command-does-not-provide-all-fields-from-REST/m-p/576216#M10195</guid>
      <dc:creator>tpavlik_splunk</dc:creator>
      <dc:date>2021-11-24T16:32:59Z</dc:date>
    </item>
  </channel>
</rss>

