<?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 Event Count to Table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512806#M143846</link>
    <description>&lt;P&gt;If your problem is resolved, then please click an "Accept as Solution" button to help future readers.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Aug 2020 16:35:15 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-08-06T16:35:15Z</dc:date>
    <item>
      <title>Adding Event Count to Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512225#M143651</link>
      <description>&lt;P&gt;I am trying to get the Date (altering _time in a specific format shown below), number of events (which I am using stats count to count the number of occurrences of "EXAMPLE" and renaming as Transactions), and the sum of a value from different events (which I have to trim USD and quotes in order to make it register as a number). I can get the results separately but when I try to get all three columns to show in one table, it will only give me the number of events. All fields come from the same log. I want it to look like this:&lt;BR /&gt;------------------------------------------------&lt;BR /&gt;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Transactions&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; entryAmountDay&lt;/P&gt;&lt;P&gt;08-02-2020&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5000.00&lt;BR /&gt;-------------------------------------------------&lt;BR /&gt;&lt;BR /&gt;What works separately:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;source=example&amp;nbsp; "EXAMPLE" &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;| stats count&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;| rename count AS Transactions&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;-------------------------&lt;BR /&gt;&lt;STRONG&gt;source=example "EXAMPLE"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;| eval Date = strftime(_time, "%m-%d-%y") | fields - _time &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;| eval entryAmount = trim(replace(entryAmount, "'USD", "")), eval entryAmount = trim(replace(entryAmount, "'", "")), eval entryAmount=trim(entryAmount)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;| stats sum(entryAmount) as entryAmountDay by Date&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;I have tried many different combinations and commands but can't get anything to work. Please help!&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 20:56:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512225#M143651</guid>
      <dc:creator>bburns2122</dc:creator>
      <dc:date>2020-08-03T20:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Event Count to Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512238#M143658</link>
      <description>&lt;P&gt;It would help if you said how the current query is failing you.&amp;nbsp; Have you tried this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;source=example "EXAMPLE"
| eval Date = strftime(_time, "%m-%d-%y") | fields - _time
| eval entryAmount = trim(replace(entryAmount, "'USD", "")), eval entryAmount = trim(replace(entryAmount, "'", "")), eval entryAmount=trim(entryAmount)
| stats sum(entryAmount) as entryAmountDay, count as Transactions by Date&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 00:38:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512238#M143658</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-08-04T00:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Event Count to Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512385#M143707</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bburns2122_0-1596550626297.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10034i8097621C71A9D22F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bburns2122_0-1596550626297.png" alt="bburns2122_0-1596550626297.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It looks like that query fails with the same issues I was having. The date and transaction field get populated but not the entryAmountDay. The entryAmountDay gets left blank.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 14:17:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512385#M143707</guid>
      <dc:creator>bburns2122</dc:creator>
      <dc:date>2020-08-04T14:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Event Count to Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512411#M143710</link>
      <description>&lt;P&gt;Splunk could be treating entryAmount as a string which it can't add up.&amp;nbsp; Try converting it to a number.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;source=example "EXAMPLE"
| eval Date = strftime(_time, "%m-%d-%y") | fields - _time
| eval entryAmount = trim(replace(entryAmount, "'USD", "")), eval entryAmount = trim(replace(entryAmount, "'", "")), eval entryAmount=tonumber(trim(entryAmount), 10)
| stats sum(entryAmount) as entryAmountDay, count as Transactions by Date&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 04 Aug 2020 16:36:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512411#M143710</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-08-04T16:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Event Count to Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512738#M143825</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp; It looks like that one gives me the same output that does not include the entryAmount. This is the only field in the log that includes the price amount so I'm not sure how else to 'transform' this to a usable number.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bburns2122_0-1596718204769.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10077iBECE8EBC11C94DFC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bburns2122_0-1596718204769.png" alt="bburns2122_0-1596718204769.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 12:51:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512738#M143825</guid>
      <dc:creator>bburns2122</dc:creator>
      <dc:date>2020-08-06T12:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Event Count to Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512744#M143829</link>
      <description>&lt;P&gt;It's time to debug the query by peeling it back.&lt;BR /&gt;Remove the &lt;FONT face="courier new,courier"&gt;stats&lt;/FONT&gt; command and verify the entryAmount field contains a number for every event. If any of them are null then that would cause the &lt;FONT face="courier new,courier"&gt;stats&lt;/FONT&gt; command to fail. We can fix that with &lt;FONT face="courier new,courier"&gt;fillnull value=0 entryAmount&lt;/FONT&gt;, but let's see what the data looks like, first.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 13:21:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512744#M143829</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-08-06T13:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Event Count to Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512765#M143833</link>
      <description>&lt;P&gt;Your first suggestion was correct with one issue, there didn't need to be the extra eval in front of the other trims.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;source=example "EXAMPLE" | eval Date = strftime(_time, "%m-%d-%y") | fields - _time | eval entryAmount = trim(replace(entryAmount, "'USD", "")), &lt;U&gt;&lt;STRONG&gt;eval&lt;/STRONG&gt;&lt;/U&gt; entryAmount = trim(replace(entryAmount, "'", "")),&lt;U&gt;&lt;STRONG&gt; eval&lt;/STRONG&gt; &lt;/U&gt;entryAmount=tonumber(trim(entryAmount), 10) | stats sum(entryAmount) as entryAmountDay, count as Transactions by Date&lt;/P&gt;&lt;P&gt;This search worked:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;source=example "EXAMPLE" | eval Date = strftime(_time, "%m-%d-%y") | fields - _time | eval entryAmount = trim(replace(entryAmount, "'USD", "")), entryAmount = trim(replace(entryAmount, "'", "")), entryAmount=tonumber(trim(entryAmount), 10) | stats sum(entryAmount) as entryAmountDay, count as Transactions by Date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your help with this!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 14:28:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512765#M143833</guid>
      <dc:creator>bburns2122</dc:creator>
      <dc:date>2020-08-06T14:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Event Count to Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512806#M143846</link>
      <description>&lt;P&gt;If your problem is resolved, then please click an "Accept as Solution" button to help future readers.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 16:35:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-Event-Count-to-Table/m-p/512806#M143846</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-08-06T16:35:15Z</dc:date>
    </item>
  </channel>
</rss>

