<?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: Stats DC With Table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284138#M85883</link>
    <description>&lt;P&gt;Hi @somesoni2, thank you for taking the time to my post.&lt;/P&gt;

&lt;P&gt;I've tried the query you kindly provided but it doesn't work. Rather than displaying the "detail.*" fields it just displays the "detail.Filing ID".&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
    <pubDate>Wed, 21 Oct 2015 05:20:09 GMT</pubDate>
    <dc:creator>IRHM73</dc:creator>
    <dc:date>2015-10-21T05:20:09Z</dc:date>
    <item>
      <title>Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284127#M85872</link>
      <description>&lt;P&gt;Hi, I wonder whether someone may be able to help me please.&lt;/P&gt;

&lt;P&gt;I'm using the the search below to return values in a table.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;auditSource="cato-filing" auditType="FilingStarted" | dedup "detail.Filing ID" | table "detail.*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I'd like to do is make this more efficient by changing the &lt;CODE&gt;dedup&lt;/CODE&gt; to &lt;CODE&gt;stats dc&lt;/CODE&gt;. Now I have used stats dc before, so I tried &lt;CODE&gt;auditSource="cato-filing" auditType="FilingStarted" | stats dc(detail.Filing ID) By "detail.*"&lt;/CODE&gt; , but for the life of me, I can't work out how to return the table of results, because my effort returns no results.&lt;/P&gt;

&lt;P&gt;I just wondered whether someone may be able to look at this please and let me know where I've gone wrong.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 05:53:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284127#M85872</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-10-20T05:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284128#M85873</link>
      <description>&lt;P&gt;Hi IRHM73,&lt;/P&gt;

&lt;P&gt;two things that I can think of:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;CODE&gt;auditSource="cato-filing" auditType="FilingStarted" | stats dc(detail.Filing ID) By "detail.*"&lt;/CODE&gt; will not work because the &lt;CODE&gt;dc(detail.Filing ID)&lt;/CODE&gt; contains a space and should be &lt;CODE&gt;dc("detail.Filing ID")&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;auditSource="cato-filing" auditType="FilingStarted" | stats dc(detail.Filing ID) By "detail.*"&lt;/CODE&gt; will not work because &lt;CODE&gt;by "detail.*"&lt;/CODE&gt; contains a wild card; take a field which is unique like &lt;CODE&gt;detail.foo&lt;/CODE&gt; or &lt;CODE&gt;detail.baz&lt;/CODE&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;You could try &lt;CODE&gt;auditSource="cato-filing" auditType="FilingStarted" | stats dc("detail.Filing ID") BY "detail.Filing ID" | table "detail.Filing ID"&lt;/CODE&gt; or just use &lt;CODE&gt;dedup&lt;/CODE&gt; .&lt;/P&gt;

&lt;P&gt;Hope this helps ... and this is un-tested &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 08:39:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284128#M85873</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-10-20T08:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284129#M85874</link>
      <description>&lt;P&gt;Hi @MuS thank you for coming back to me with this. I'm trying to get away from dedup because of it's over use of resources.&lt;/P&gt;

&lt;P&gt;I have tried the query you kindly provided and I appreciate that this was untested, but unfortunately this doesn't work.&lt;/P&gt;

&lt;P&gt;However I've found that rather than using "detail.*" I can use the fields:&lt;/P&gt;

&lt;P&gt;detail.CompanyName&lt;BR /&gt;
detail.Department&lt;BR /&gt;
detail.Location&lt;/P&gt;

&lt;P&gt;I'm not sure whether that helps.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 08:56:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284129#M85874</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-10-20T08:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284130#M85875</link>
      <description>&lt;P&gt;As per my understanding from your question, you could rename before stats something like this.&lt;/P&gt;

&lt;P&gt;| rename "detail.Filing ID" as FilingID | stats dc(FilingID)&lt;/P&gt;

&lt;P&gt;Hope this helps !&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 11:56:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284130#M85875</guid>
      <dc:creator>immortalraghava</dc:creator>
      <dc:date>2015-10-20T11:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284131#M85876</link>
      <description>&lt;P&gt;Hi @immortalraghaven,&lt;/P&gt;

&lt;P&gt;Thank you for taking the time to reply to my post.&lt;/P&gt;

&lt;P&gt;Unfortunately the rename won't work because I'm trying to use a 'stats dc' for multiple fields as per my last post to @MuS.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 12:00:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284131#M85876</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-10-20T12:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284132#M85877</link>
      <description>&lt;P&gt;What makes you think that &lt;CODE&gt;dedup&lt;/CODE&gt; is inefficient?  What makes you think that &lt;CODE&gt;dedup&lt;/CODE&gt; is any different from &lt;CODE&gt;stats latest(_raw) AS _raw&lt;/CODE&gt; (which will be pretty much the same work as &lt;CODE&gt;stats dc&lt;/CODE&gt;)?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 15:10:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284132#M85877</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-20T15:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284133#M85878</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; auditSource="cato-filing" auditType="FilingStarted" | stats values(detail.Filing ID)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Oct 2015 15:11:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284133#M85878</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-20T15:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284134#M85879</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;auditSource="cato-filing" auditType="FilingStarted"  | table "detail.*" | stats latest(*) as * by "detail.Filing ID" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will do same function as dedup&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 16:20:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284134#M85879</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-10-20T16:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284135#M85880</link>
      <description>&lt;P&gt;To make it more flexible to cover more fields, you can do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;auditSource="cato-filing" auditType="FilingStarted" | stats values(detail.*)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Oct 2015 17:01:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284135#M85880</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-20T17:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284136#M85881</link>
      <description>&lt;P&gt;&lt;CODE&gt;dedup&lt;/CODE&gt; compared to a &lt;CODE&gt;stats dc by&lt;/CODE&gt; is indeed less efficient. When using &lt;CODE&gt;dedup&lt;/CODE&gt; most (if not all) of the &lt;CODE&gt;_raw&lt;/CODE&gt; events must be returned to the search head. When using &lt;CODE&gt;stats&lt;/CODE&gt;, only the &lt;CODE&gt;dc&lt;/CODE&gt; and the &lt;CODE&gt;by clause field&lt;/CODE&gt; are returned to the search head - which gives a better performance when re-assembling on the search head to do the final &lt;CODE&gt;stats&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 19:32:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284136#M85881</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2015-10-20T19:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284137#M85882</link>
      <description>&lt;P&gt;Just for the fun of it, I ran all searches as run everywhere examples with fixed time range and leave you to choose the fastest/best for your use case:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal earliest=-2d@d latest=-1d@d | dedup sourcetype | table sourcetype
This search has completed and has returned 8 results by scanning 2,907,591 events in 249.892 seconds.
index=_internal earliest=-2d@d latest=-1d@d | stats dc(sourcetype) by sourcetype
This search has completed and has returned 8 results by scanning 2,907,591 events in 229.72 seconds.
index=_internal earliest=-2d@d latest=-1d@d | stats latest(sourcetype) by sourcetype
This search has completed and has returned 8 results by scanning 2,907,591 events in 228.705 seconds.
index=_internal earliest=-2d@d latest=-1d@d | table sourcetype | stats latest(*) as * by sourcetype
This search has completed and has returned 8 results by scanning 2,907,591 events in 382.519 seconds.
index=_internal earliest=-2d@d latest=-1d@d | table sourcetype | stats values(sourcetype)
This search has completed and has returned 1 result by scanning 2,907,591 events in 388.672 seconds.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 20:15:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284137#M85882</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-10-20T20:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284138#M85883</link>
      <description>&lt;P&gt;Hi @somesoni2, thank you for taking the time to my post.&lt;/P&gt;

&lt;P&gt;I've tried the query you kindly provided but it doesn't work. Rather than displaying the "detail.*" fields it just displays the "detail.Filing ID".&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 05:20:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284138#M85883</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-10-21T05:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284139#M85884</link>
      <description>&lt;P&gt;Hi @Mus, thank you very much for this.&lt;/P&gt;

&lt;P&gt;It provide some interesting reading.&lt;/P&gt;

&lt;P&gt;Kind Regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 05:43:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284139#M85884</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-10-21T05:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284140#M85885</link>
      <description>&lt;P&gt;Hi @woodcock, thank you for taking the time to reply to my post.&lt;/P&gt;

&lt;P&gt;I've tried the query you kindly provided, and although it does extract all the fields which is great, rather than each record being on it's own row, they are all contained within one.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 05:48:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284140#M85885</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-10-21T05:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284141#M85886</link>
      <description>&lt;P&gt;OK, then just add this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | foreach values* [ mvexpand &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Oct 2015 14:06:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284141#M85886</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-21T14:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284142#M85887</link>
      <description>&lt;P&gt;just to be complete, here is the latest command ran on the same server as yesterday:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal earliest=-3d@d latest=-2d@d | stats values(sourcetype) | foreach values* [ mvexpand &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; ]
This search has completed and has returned 8 results by scanning 2,907,591 events in 248.982 seconds.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Oct 2015 20:28:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284142#M85887</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-10-21T20:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284143#M85888</link>
      <description>&lt;P&gt;So just to throw in my two cents:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;auditSource="cato-filing" auditType="FilingStarted"  | rename detail.* as * | stats dc("Filing ID") as "Filing ID" by CompanyName Department Location
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Oct 2015 21:27:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284143#M85888</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2015-10-21T21:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284144#M85889</link>
      <description>&lt;P&gt;HI @alacercogitatus, thank you for taking the time to reply to my post.&lt;/P&gt;

&lt;P&gt;I tried the query you kindly provided, but unfortunately this create a table.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 05:13:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284144#M85889</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-10-22T05:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284145#M85890</link>
      <description>&lt;P&gt;Hi @woodcock, thank you for coming back to me with this, but unfortunately this doesn't change the layout of the results.&lt;/P&gt;

&lt;P&gt;I think I'll have to say with the 'dedup' because I think what I want to achieve isn't possible.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris &lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 05:16:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284145#M85890</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-10-22T05:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Stats DC With Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284146#M85891</link>
      <description>&lt;P&gt;Hi, thank you very much for this.&lt;/P&gt;

&lt;P&gt;I think I'll have to stay with the dedup because what I want to achieve doesn't seem possible.&lt;/P&gt;

&lt;P&gt;Kind Regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 05:18:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-DC-With-Table/m-p/284146#M85891</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-10-22T05:18:46Z</dc:date>
    </item>
  </channel>
</rss>

