<?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 and event order in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-keep-row-data-together-when-using-the-stats/m-p/519444#M146312</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/159620"&gt;@marycordova&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your answers.&lt;/P&gt;&lt;P&gt;Your solutions would work if my event contained a few fields. However, the data includes 20+ fields [Loc, FN, LN, Address, City, State, Zip, Phone, ID, etc.]; and will be increasing to over 100 fields. If we &lt;STRONG&gt;mvappend&lt;/STRONG&gt; all of these fields, this would be extremely inefficient, as well as make sorting/searching on a specific field(s) very cumbersome.&lt;/P&gt;&lt;P&gt;A colleague suggested using &lt;STRONG&gt;list&lt;/STRONG&gt; instead of &lt;STRONG&gt;values&lt;/STRONG&gt;:&lt;FONT color="#0000FF"&gt;&lt;EM&gt; | stats list(FirstName), list(LastName) BY Loc&lt;/EM&gt;&lt;/FONT&gt;. However, I don't believe Splunk would handle event data where a field was null or blank properly. It would not enter a blank line in the results table.&lt;/P&gt;&lt;P&gt;Thanks again and God bless,&lt;BR /&gt;Genesius&lt;/P&gt;</description>
    <pubDate>Mon, 14 Sep 2020 14:03:24 GMT</pubDate>
    <dc:creator>genesiusj</dc:creator>
    <dc:date>2020-09-14T14:03:24Z</dc:date>
    <item>
      <title>Is there a way to keep row data together when using the stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-keep-row-data-together-when-using-the-stats/m-p/519164#M146185</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Is there a way to keep row data together when using the stats command?&lt;/P&gt;
&lt;P&gt;ID&amp;nbsp; &amp;nbsp;Loc&amp;nbsp; &amp;nbsp;FirstName&amp;nbsp; LastName&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;1     NYC   Tom Jones
2     CHI   Peggy Sue
3     BOS   Phil Collins
4     BOS   John Lennon
5     NYC   Paul McCartney&lt;/LI-CODE&gt;
&lt;P&gt;If I used `| stats values(FirstName), values(LastName) BY Loc` I believe I would get this.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;BOS   John Collins
      Phil Lennon
CHI   Peggy Sue
NYC   Paul Jones
      Tom McCartney&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;How do I keep&amp;nbsp;FirstName and&amp;nbsp;LastName together BY Loc?&lt;BR /&gt;This is a scaled-down example. I have more than 20 fields, and over 10,000 events.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;/P&gt;
&lt;P&gt;Stay safe and healthy, you and yours.&lt;BR /&gt;God bless,&lt;/P&gt;
&lt;P&gt;Genesius&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 18:53:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-keep-row-data-together-when-using-the-stats/m-p/519164#M146185</guid>
      <dc:creator>genesiusj</dc:creator>
      <dc:date>2020-09-14T18:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: stats and event order</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-keep-row-data-together-when-using-the-stats/m-p/519167#M146187</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval joined=mvappend(FirstName, LastName)
| eval joined=mvjoin(joined, " ")
| stats values(joined) as Name BY Loc&lt;/LI-CODE&gt;&lt;P&gt;Not sure if that's what you meant&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2020 21:46:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-keep-row-data-together-when-using-the-stats/m-p/519167#M146187</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-11T21:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: stats and event order</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-keep-row-data-together-when-using-the-stats/m-p/519181#M146192</link>
      <description>&lt;P&gt;I like to use mvzip:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Name=mvzip('LastName','FirstName',", ")
| stats values(Name) as Name by Loc&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That gives you something like:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;BOS&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;Collins, Phil&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Lennon, John&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;CHI&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;Sue, Peggy&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;NYC&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;Jones, Tom&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;McCartney, Paul&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use this kind of thing with a DHCP lookup table I build so that the IP to NIC/MAC to hostname to timestamp relationship is preserved.&amp;nbsp; Otherwise if you just did stats values IP values MAC by hostname you wouldn't know which IP went with which MAC address.&amp;nbsp; And if you want to preserve a reference history you also need to link these assignments to the date/time they were assigned.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Sep 2020 03:45:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-keep-row-data-together-when-using-the-stats/m-p/519181#M146192</guid>
      <dc:creator>marycordova</dc:creator>
      <dc:date>2020-09-12T03:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: stats and event order</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-keep-row-data-together-when-using-the-stats/m-p/519444#M146312</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/159620"&gt;@marycordova&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your answers.&lt;/P&gt;&lt;P&gt;Your solutions would work if my event contained a few fields. However, the data includes 20+ fields [Loc, FN, LN, Address, City, State, Zip, Phone, ID, etc.]; and will be increasing to over 100 fields. If we &lt;STRONG&gt;mvappend&lt;/STRONG&gt; all of these fields, this would be extremely inefficient, as well as make sorting/searching on a specific field(s) very cumbersome.&lt;/P&gt;&lt;P&gt;A colleague suggested using &lt;STRONG&gt;list&lt;/STRONG&gt; instead of &lt;STRONG&gt;values&lt;/STRONG&gt;:&lt;FONT color="#0000FF"&gt;&lt;EM&gt; | stats list(FirstName), list(LastName) BY Loc&lt;/EM&gt;&lt;/FONT&gt;. However, I don't believe Splunk would handle event data where a field was null or blank properly. It would not enter a blank line in the results table.&lt;/P&gt;&lt;P&gt;Thanks again and God bless,&lt;BR /&gt;Genesius&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 14:03:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-keep-row-data-together-when-using-the-stats/m-p/519444#M146312</guid>
      <dc:creator>genesiusj</dc:creator>
      <dc:date>2020-09-14T14:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: stats and event order</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-keep-row-data-together-when-using-the-stats/m-p/519902#M146406</link>
      <description>&lt;P&gt;You are right about nulls/empty strings being omitted from the list so you could try using a space filler&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fillnull value=" " FirstName, LastName
| stats list(FirstName) as FirstName, list(LastName) as LastName by Loc&lt;/LI-CODE&gt;&lt;P&gt;Note it can't be an empty string&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 12:15:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-keep-row-data-together-when-using-the-stats/m-p/519902#M146406</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-16T12:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to keep row data together when using the stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-keep-row-data-together-when-using-the-stats/m-p/678374#M231984</link>
      <description>&lt;P&gt;When using stats, rather than using values, use list for each field instead:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;&lt;SPAN&gt;| stats list(FirstName), list(LastName) by Loc&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 20:01:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-keep-row-data-together-when-using-the-stats/m-p/678374#M231984</guid>
      <dc:creator>Nextbeat</dc:creator>
      <dc:date>2024-02-22T20:01:28Z</dc:date>
    </item>
  </channel>
</rss>

