<?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: Adding First Column to the Table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462039#M130254</link>
    <description>&lt;P&gt;Please share your current search query.&lt;/P&gt;</description>
    <pubDate>Sun, 24 May 2020 14:11:08 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-05-24T14:11:08Z</dc:date>
    <item>
      <title>Adding First Column to the Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462038#M130253</link>
      <description>&lt;P&gt;I'm generating the output for Column 2, 3  from search. I want to add column to the start of the table. In the below example, I want to add the First Column "Product" with values "Product1" &amp;amp; "Product2". Please shed some light here. Appreciate your help in advance.&lt;/P&gt;

&lt;H2&gt;example&lt;/H2&gt;

&lt;H2&gt;Product         Pass Count            Fail Count&lt;/H2&gt;

&lt;P&gt;Product1         5                           5&lt;BR /&gt;
Product2         1                           4&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 09:33:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462038#M130253</guid>
      <dc:creator>dustintroop</dc:creator>
      <dc:date>2020-05-24T09:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Adding First Column to the Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462039#M130254</link>
      <description>&lt;P&gt;Please share your current search query.&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 14:11:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462039#M130254</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-05-24T14:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: Adding First Column to the Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462040#M130255</link>
      <description>&lt;P&gt;Here is my current search &lt;/P&gt;

&lt;P&gt;index=abc source="bcd" earliest=-24h@h | where like('Source_Team', "%BDLM%") | rex max_match=0 "(?PPass*)" | eval count=mvcount(Method) | stats sum(count) as Compliant | appendcols [ search index=abc source="bcd" earliest=-24h@h | where like('Source_Team', "%BDLM%") | rex max_match=0 "(?PFail*)" | eval count=mvcount(Method) | stats sum(count) as Non-Compliant]&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:31:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462040#M130255</guid>
      <dc:creator>dustintroop</dc:creator>
      <dc:date>2020-09-30T05:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: Adding First Column to the Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462041#M130256</link>
      <description>&lt;P&gt;One can add fields ("columns ") at any time and then use the &lt;CODE&gt;table&lt;/CODE&gt; command to put them in the desired order.  In this case, however, the two searches can be combined and all fields generated at once with &lt;CODE&gt;stats&lt;/CODE&gt;.  The forum mangled the regular expressions (use the code &lt;CODE&gt;101010&lt;/CODE&gt; button to prevent that) so you'll have to fix them before running this example.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abc source="bcd" earliest=-24h@h 
| where like('Source_Team', "%BDLM%") 
| rex max_match=0 "(?&amp;lt;Pass&amp;gt;Pass*)" 
| rex max_match=0 "(?&amp;lt;Fail&amp;gt;Fail*)" 
| eval passCount=mvcount(Pass), failCount=mvcount(Fail) 
| stats sum(passCount) as Compliant, sum(failCount) as Non-Compliant by Product
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 24 May 2020 19:57:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462041#M130256</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-05-24T19:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Adding First Column to the Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462042#M130257</link>
      <description>&lt;P&gt;@richgalloway. Thanks a bunch for consolidating the search. It is working when i remove the "by product" string from the search at the end. So, i'm not able to add the First column&lt;/P&gt;

&lt;P&gt;The Events against which i'm performing this search doesn't have a field called product. I want to add the first column manually [since this field didn't exists anywhere] to the table.&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 20:25:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462042#M130257</guid>
      <dc:creator>dustintroop</dc:creator>
      <dc:date>2020-05-24T20:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: Adding First Column to the Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462043#M130258</link>
      <description>&lt;P&gt;Not having the Product field in the raw data complicates matters a bit.  It's easy enough to use &lt;CODE&gt;eval Product= foo&lt;/CODE&gt; to add a field, but how will Splunk know which product name to associate with each event?  Is there some other field that be used to determine the product?&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 20:42:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462043#M130258</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-05-24T20:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Adding First Column to the Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462044#M130259</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;...
| streamstats count
| eval Product="Product".count
| table Product *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to make it simply from the top, this is it.&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 20:55:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462044#M130259</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-24T20:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: Adding First Column to the Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462045#M130260</link>
      <description>&lt;P&gt;Thanks again @richgalloway. You have driven me to the solution. I have a unique identifier for a each product in the "Source_Team" field. So i renamed both the field name as well as the values in that fields to have what i desired to display. &lt;/P&gt;

&lt;P&gt;Appreciate your Valuable Time &amp;amp; help.&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 21:18:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462045#M130260</guid>
      <dc:creator>dustintroop</dc:creator>
      <dc:date>2020-05-24T21:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Adding First Column to the Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462046#M130261</link>
      <description>&lt;P&gt;One last help. how can i add Pass percentage and Fail Percentage in the table ?. Below is the current search.&lt;/P&gt;

&lt;P&gt;index=abcd source="bcd" earliest=-24h@h &lt;BR /&gt;
 | where like('Source_Team', "%BDLM%") &lt;BR /&gt;
 | rex max_match=0 "(?Pass*)"&lt;BR /&gt;
 | rex max_match=0 "(?Fail*)" &lt;BR /&gt;
 | rex max_match=0 "(?(Pass|Fail))"&lt;BR /&gt;
 | eval passCount=mvcount(Pass), failCount=mvcount(Fail), TotalCount=mvcount(BOTH)&lt;BR /&gt;
 | stats sum(TotalCount) as Total_Checks, sum(passCount) as Pass_Count, sum(failCount) as Fail_Count by Product&lt;BR /&gt;
 | fillnull value=0 Pass_Count,Fail_Count,Total_Checks&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:31:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462046#M130261</guid>
      <dc:creator>dustintroop</dc:creator>
      <dc:date>2020-09-30T05:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: Adding First Column to the Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462047#M130262</link>
      <description>&lt;P&gt;Put this after &lt;CODE&gt;stats&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval passPct = Pass_Count * 100 / Total_Checks, failPct = failCount * 100 / Total_Checks
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 24 May 2020 23:35:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-First-Column-to-the-Table/m-p/462047#M130262</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-05-24T23:35:33Z</dc:date>
    </item>
  </channel>
</rss>

