<?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 to add Count Column to a Table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-Count-Column-to-a-Table/m-p/128144#M184411</link>
    <description>&lt;P&gt;I had a typo in the solution but I fixed it (I had the same field name in both &lt;CODE&gt;values&lt;/CODE&gt; commands).  Try it now.&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jul 2015 16:28:46 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-07-20T16:28:46Z</dc:date>
    <item>
      <title>How to add Count Column to a Table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-Count-Column-to-a-Table/m-p/128140#M184407</link>
      <description>&lt;P&gt;I have a table with 3 fields (IP Address, Web Request, and Browser used).. How can I add a column to that table to count the frequency of IP addresses?&lt;/P&gt;

&lt;P&gt;I suspect that I have to change my search around because the IP Addresses are listed multiple times, so I think I have to make them list one time then add a column to count the occurrences. &lt;/P&gt;

&lt;P&gt;So can someone help me add a column to count the number of times the IP is clicked &lt;/P&gt;

&lt;P&gt;Here's my search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=access OR index=main | transaction RTG_JSession   | table  RTG_IPmain dc(RTG_IPmain) RTG_WebRequest RTG_Browser  | where isnotnull(RTG_IPmain)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jul 2015 14:48:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-Count-Column-to-a-Table/m-p/128140#M184407</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-07-17T14:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to add Count Column to a Table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-Count-Column-to-a-Table/m-p/128141#M184408</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=access OR index=main | transaction RTG_JSession | table RTG_IPmain RTG_WebRequest RTG_Browser | where isnotnull(RTG_IPmain) | stats count values(RTG_WebRequest) values(RTG_Browser) BY RTG_IPmain
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jul 2015 15:51:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-Count-Column-to-a-Table/m-p/128141#M184408</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-17T15:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to add Count Column to a Table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-Count-Column-to-a-Table/m-p/128142#M184409</link>
      <description>&lt;P&gt;I had to take the space out between values and (RTG_WebRequest) to get it to work. But its close to what I need. I see a Count column there now but I'm having the following issues.. &lt;/P&gt;

&lt;P&gt;1) Anytime the count is greater than 1, there is no RTG_WebRequest results (They are null)&lt;BR /&gt;
2) The RTG_Browser column disappeared  &lt;/P&gt;

&lt;P&gt;Also, the search looks like it's counting the WebRequest occurrences and not the IPmain occurrences.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:45:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-Count-Column-to-a-Table/m-p/128142#M184409</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2020-09-29T06:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to add Count Column to a Table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-Count-Column-to-a-Table/m-p/128143#M184410</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=access OR index=main | transaction RTG_JSession   | table  RTG_IPmain RTG_WebRequest RTG_Browser  | eventstats dc(RTG_IPmain)  as Count  | where isnotnull(RTG_IPmain)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jul 2015 16:00:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-Count-Column-to-a-Table/m-p/128143#M184410</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-07-20T16:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to add Count Column to a Table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-Count-Column-to-a-Table/m-p/128144#M184411</link>
      <description>&lt;P&gt;I had a typo in the solution but I fixed it (I had the same field name in both &lt;CODE&gt;values&lt;/CODE&gt; commands).  Try it now.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2015 16:28:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-Count-Column-to-a-Table/m-p/128144#M184411</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-20T16:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to add Count Column to a Table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-Count-Column-to-a-Table/m-p/128145#M184412</link>
      <description>&lt;P&gt;Works perfectly! I was getting some null values in the RTG_WebRequest due to an error in my regular expression when I extracted that field. I did a lookbehind which didn't account for a string I wasn't aware of. I included that and all the fields populated exactly like they should have&lt;/P&gt;

&lt;P&gt;Here's my search for anyone needing it in the future &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=access OR index=main | transaction RTG_JSession | table RTG_IPmain RTG_WebRequest RTG_Browser | stats count values(RTG_Browser) values(RTG_WebRequest) BY RTG_IPmain | sort -count | rename RTG_IPmain AS "IP Address" | rename  count AS "JSession Count" | rename "values(RTG_Browser)" AS "Browser" | rename "values(RTG_WebRequest)" AS "Web Request"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jul 2015 19:15:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-Count-Column-to-a-Table/m-p/128145#M184412</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-07-20T19:15:35Z</dc:date>
    </item>
  </channel>
</rss>

