<?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 do I remove dynamically named columns from a table when their values contain a specific string? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-remove-dynamically-named-columns-from-a-table-when/m-p/413964#M119283</link>
    <description>&lt;P&gt;After a lot of searching and taking bits and pieces from a lot of answers that did not address my issue, I was able to get what I wanted with the following.  the rename was required due to the special characters in the field names.&lt;/P&gt;

&lt;P&gt;The first foreach actually sets the "null" values to NULL, the second sets the "" values to NULL.  this allows the transpose option for include_empty = False to work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rename *.*.* AS *_*_* , *.*.*{}.* as *_*_*_* 
| foreach request* 
    [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;="null", NULL, &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;) ] 
| foreach codeDropUploadMap* 
    [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;="", NULL, &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;) ] 
| transpose include_empty=false
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 10 Oct 2018 20:37:28 GMT</pubDate>
    <dc:creator>Cuyose</dc:creator>
    <dc:date>2018-10-10T20:37:28Z</dc:date>
    <item>
      <title>How do I remove dynamically named columns from a table when their values contain a specific string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-remove-dynamically-named-columns-from-a-table-when/m-p/413962#M119281</link>
      <description>&lt;P&gt;I have an API input that returns a JSON object containing a nested element with multiple dynamically named columns, where date is the dynamic portion.  ex. request.20181201.instructions,  request.20181101.instructions,  request.20181011.instructions, etc&lt;/P&gt;

&lt;P&gt;90 % of these fields will have a literal value of "null" or actually be null.  I want to only return the columns other than these.&lt;/P&gt;

&lt;P&gt;Basically the psuedocode would be &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table request.* |where .value=*  AND .value!="null" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there any way to do this?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 19:32:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-remove-dynamically-named-columns-from-a-table-when/m-p/413962#M119281</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2018-10-10T19:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove dynamically named columns from a table when their values contain a specific string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-remove-dynamically-named-columns-from-a-table-when/m-p/413963#M119282</link>
      <description>&lt;P&gt;The standard way would be ...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| streamstats count as recno
| untable recno fieldname fieldvalue
| where NOT like(fieldname,"something")
| xyseries recno fieldname fieldvalue
| fields - recno
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Oct 2018 19:59:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-remove-dynamically-named-columns-from-a-table-when/m-p/413963#M119282</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-10-10T19:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove dynamically named columns from a table when their values contain a specific string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-remove-dynamically-named-columns-from-a-table-when/m-p/413964#M119283</link>
      <description>&lt;P&gt;After a lot of searching and taking bits and pieces from a lot of answers that did not address my issue, I was able to get what I wanted with the following.  the rename was required due to the special characters in the field names.&lt;/P&gt;

&lt;P&gt;The first foreach actually sets the "null" values to NULL, the second sets the "" values to NULL.  this allows the transpose option for include_empty = False to work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rename *.*.* AS *_*_* , *.*.*{}.* as *_*_*_* 
| foreach request* 
    [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;="null", NULL, &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;) ] 
| foreach codeDropUploadMap* 
    [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;="", NULL, &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;) ] 
| transpose include_empty=false
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Oct 2018 20:37:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-remove-dynamically-named-columns-from-a-table-when/m-p/413964#M119283</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2018-10-10T20:37:28Z</dc:date>
    </item>
  </channel>
</rss>

