<?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 can I remove the fields X which has all zero values? OR how do I show only fields with non-zero values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397326#M115316</link>
    <description>&lt;P&gt;Or&lt;/P&gt;

&lt;P&gt;| fillnull value=“NULL”&lt;BR /&gt;
  | search NOT NULL&lt;/P&gt;</description>
    <pubDate>Mon, 14 May 2018 01:25:04 GMT</pubDate>
    <dc:creator>jkat54</dc:creator>
    <dc:date>2018-05-14T01:25:04Z</dc:date>
    <item>
      <title>How can I remove the fields X which has all zero values? OR how do I show only fields with non-zero values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397324#M115314</link>
      <description>&lt;P&gt;This is may sample search and ample dataset: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | makeresults 
    | eval data = "
    1    2017-12-01 00:00:00    A    0    131033    84.1;
   2    2017-12-01 00:30:00    B    0    23627    95;
   3    2017-12-01 00:45:00    C    0    117185    99.6;
   " 
    | makemv delim=";" data 
    | mvexpand data
    | rex field=data "(?&amp;lt;serial&amp;gt;\d)\s+(?&amp;lt;date&amp;gt;\d+-\d+-\d+ \d+:\d+:\d+)\s+(?&amp;lt;type&amp;gt;\w)\s+(?&amp;lt;attempts&amp;gt;\d+)\s+(?&amp;lt;successfullAttempts&amp;gt;\d+)\s+(?&amp;lt;sr&amp;gt;\d+)"
    | fields + date serial type attempts successfullAttempts sr 
    | rename date as _time 
    | search serial=*
| 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which gives: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   serial  type    attempts    successfullAttempts sr
1   2017-12-01 00:00:00 1   A   0   131033  84
2   2017-12-01 00:30:00 2   B   0   23627   95
3   2017-12-01 00:45:00 3   C   0   117185  99
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;How can I remove the field &lt;CODE&gt;attempts&lt;/CODE&gt; which has all zero values? OR how do I show only fields with non-zero values?&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I know I can do &lt;CODE&gt;fields - attempts&lt;/CODE&gt;, but I am looking for a solution where I can apply it to many fields, and fields that I don't necessarily know the name of.  &lt;/P&gt;

&lt;P&gt;This &lt;A href="https://answers.splunk.com/answers/565053/show-only-non-zero-fields.html"&gt;answer&lt;/A&gt; is close to what I am thinking using transpose, but then I want to convert it back to timechart format with the _time the leftmost column. This answer does successfully find the columns that have non zero values, but it is not in the timechart format that I want.&lt;/P&gt;</description>
      <pubDate>Sun, 13 May 2018 23:09:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397324#M115314</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2018-05-13T23:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: How can I remove the fields X which has all zero values? OR how do I show only fields with non-zero values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397325#M115315</link>
      <description>&lt;P&gt;How about something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where isnotnull(*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 01:21:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397325#M115315</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2018-05-14T01:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can I remove the fields X which has all zero values? OR how do I show only fields with non-zero values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397326#M115316</link>
      <description>&lt;P&gt;Or&lt;/P&gt;

&lt;P&gt;| fillnull value=“NULL”&lt;BR /&gt;
  | search NOT NULL&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 01:25:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397326#M115316</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2018-05-14T01:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: How can I remove the fields X which has all zero values? OR how do I show only fields with non-zero values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397327#M115317</link>
      <description>&lt;P&gt;tks, but they don't work.&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 03:24:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397327#M115317</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2018-05-14T03:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: How can I remove the fields X which has all zero values? OR how do I show only fields with non-zero values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397328#M115318</link>
      <description>&lt;P&gt;That will filter the events containing a zero/NULL value... however, the request is to remove columns that contain zero/NULL for all events, and I've to admit nothing useful comes to my head right now.&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 07:52:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397328#M115318</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-05-14T07:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: How can I remove the fields X which has all zero values? OR how do I show only fields with non-zero values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397329#M115319</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/155306/how-to-exclude-events-with-null-fields-in-a-search.html"&gt;have a look into this link&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
     | eval data = "
     1    2017-12-01 00:00:00    A    0    131033    84.1;
    2    2017-12-01 00:30:00    B    0    23627    95;
    3    2017-12-01 00:45:00    C    0    117185    99.6;
    " 
     | makemv delim=";" data 
     | mvexpand data
     | rex field=data "(?&amp;lt;serial&amp;gt;\d)\s+(?&amp;lt;date&amp;gt;\d+-\d+-\d+ \d+:\d+:\d+)\s+(?&amp;lt;type&amp;gt;\w)\s+(?&amp;lt;attempts&amp;gt;\d+)\s+(?&amp;lt;successfullAttempts&amp;gt;\d+)\s+(?&amp;lt;sr&amp;gt;\d+)"
     | fields + date serial type attempts successfullAttempts sr 
     | rename date as _time 
     | search serial=* 
| transpose 
| rename "row 1" as f1,"row 2" as f2,"row 3" as f3 
| where f1 !=0 and f2!=0 and f3!=0 
| transpose header_field=column | fields - column
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 May 2018 09:59:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397329#M115319</guid>
      <dc:creator>harishalipaka</dc:creator>
      <dc:date>2018-05-14T09:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: How can I remove the fields X which has all zero values? OR how do I show only fields with non-zero values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397330#M115320</link>
      <description>&lt;P&gt;This is good, thanks. however,&lt;BR /&gt;&lt;BR /&gt;
1/ with &lt;CODE&gt;| where f1 !=0 and f2!=0 and f3!=0&lt;/CODE&gt; I lose my &lt;CODE&gt;_time&lt;/CODE&gt; column and my &lt;CODE&gt;type&lt;/CODE&gt; column with values &lt;CODE&gt;A&lt;/CODE&gt;, &lt;CODE&gt;B&lt;/CODE&gt; and &lt;CODE&gt;C&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Also, if I can fix 1/ above then I want to be able to write this &lt;CODE&gt;| rename "row 1" as f1,"row 2" as f2,"row 3" as f3  | where f1 !=0 and f2!=0 and f3!=0&lt;/CODE&gt; more dynamically that is if I did not know how to many rows there were.&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 23:19:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397330#M115320</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2018-05-14T23:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can I remove the fields X which has all zero values? OR how do I show only fields with non-zero values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397331#M115321</link>
      <description>&lt;P&gt;just had another look at this: &lt;/P&gt;

&lt;P&gt;if all the values in a field are zero then remove it e.g. fields - fieldname but not sure if it can be done.&lt;BR /&gt;
&lt;CODE&gt;foreach * [eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'==0,"delete",'&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')] | where * != "delete"&lt;/CODE&gt;&lt;BR /&gt;
OR&lt;BR /&gt;
&lt;CODE&gt;where * &amp;gt; 0&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 May 2018 22:42:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-remove-the-fields-X-which-has-all-zero-values-OR-how/m-p/397331#M115321</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2018-05-20T22:42:43Z</dc:date>
    </item>
  </channel>
</rss>

