<?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 How do I get a table with a count and distinct count using a field regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/480994#M134777</link>
    <description>&lt;P&gt;I would like to get a count of errors that I have generated on splunk from different objects. All of them have a field error.&lt;/P&gt;

&lt;P&gt;This is my query:&lt;BR /&gt;
index="db-woodchipper"  earliest=-7d@d latest=now \"Error\": | table *.Error &lt;/P&gt;

&lt;P&gt;Results:&lt;BR /&gt;
![alt text][1]&lt;/P&gt;

&lt;P&gt;RAW:&lt;BR /&gt;
{"SalesforceUpdater": {"MessageBody": {"ServerName": "xxxxxx", "DbName": "&lt;A href="mailto:xxx@xxxxx.com"&gt;xxx@xxxxx.com&lt;/A&gt;"}, "Error": "FATAL:  database \"&lt;A href="mailto:xxxx@xxx.xxx"&gt;xxxx@xxx.xxx&lt;/A&gt;\" does not exist\n"}}&lt;/P&gt;

&lt;P&gt;{"EmailSettingsCorrection": {"MessageBody": {"ServerName": "xxxxxx", "DbName": "xxxxxxx"}, "Task": "EmailSettingsCorrection", "Error": "FATAL:  database \"xxxxxx\" does not exist\n"}}&lt;/P&gt;

&lt;P&gt;However I would like to have something like:&lt;BR /&gt;
Operation.                         |Count | Count Distinct&lt;BR /&gt;
EmailSettingsCorrection |   10     |          2&lt;BR /&gt;
SalesforceUpdater           |   5       |          1&lt;/P&gt;

&lt;P&gt;And so on....&lt;/P&gt;</description>
    <pubDate>Mon, 20 Apr 2020 18:39:25 GMT</pubDate>
    <dc:creator>felipesodre</dc:creator>
    <dc:date>2020-04-20T18:39:25Z</dc:date>
    <item>
      <title>How do I get a table with a count and distinct count using a field regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/480994#M134777</link>
      <description>&lt;P&gt;I would like to get a count of errors that I have generated on splunk from different objects. All of them have a field error.&lt;/P&gt;

&lt;P&gt;This is my query:&lt;BR /&gt;
index="db-woodchipper"  earliest=-7d@d latest=now \"Error\": | table *.Error &lt;/P&gt;

&lt;P&gt;Results:&lt;BR /&gt;
![alt text][1]&lt;/P&gt;

&lt;P&gt;RAW:&lt;BR /&gt;
{"SalesforceUpdater": {"MessageBody": {"ServerName": "xxxxxx", "DbName": "&lt;A href="mailto:xxx@xxxxx.com"&gt;xxx@xxxxx.com&lt;/A&gt;"}, "Error": "FATAL:  database \"&lt;A href="mailto:xxxx@xxx.xxx"&gt;xxxx@xxx.xxx&lt;/A&gt;\" does not exist\n"}}&lt;/P&gt;

&lt;P&gt;{"EmailSettingsCorrection": {"MessageBody": {"ServerName": "xxxxxx", "DbName": "xxxxxxx"}, "Task": "EmailSettingsCorrection", "Error": "FATAL:  database \"xxxxxx\" does not exist\n"}}&lt;/P&gt;

&lt;P&gt;However I would like to have something like:&lt;BR /&gt;
Operation.                         |Count | Count Distinct&lt;BR /&gt;
EmailSettingsCorrection |   10     |          2&lt;BR /&gt;
SalesforceUpdater           |   5       |          1&lt;/P&gt;

&lt;P&gt;And so on....&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 18:39:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/480994#M134777</guid>
      <dc:creator>felipesodre</dc:creator>
      <dc:date>2020-04-20T18:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a table with a count and distinct count using a field regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/480995#M134778</link>
      <description>&lt;P&gt;hi @felipesodre,&lt;/P&gt;

&lt;P&gt;Try this query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="db-woodchipper" earliest=-7d@d latest=now \"Error\": 
| table *.Error 
| stats count(*) as *, dc(*) as Distinct_* 
| transpose column_name=Operation 
| eval Distinct=if(like(Operation, "Distinct%"), 'row 1', ""), count=if(like(Operation, "Distinct%"), "", 'row 1'), Operation=replace(Operation, "Distinct_", "") 
| stats sum(count) as Count, sum(Distinct) as "Count Distinct" by Operation
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Apr 2020 21:07:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/480995#M134778</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-04-20T21:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a table with a count and distinct count using a field regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/480996#M134779</link>
      <description>&lt;P&gt;Perfect. &lt;BR /&gt;
It worked. &lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 22:51:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/480996#M134779</guid>
      <dc:creator>felipesodre</dc:creator>
      <dc:date>2020-04-20T22:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a table with a count and distinct count using a field regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/480997#M134780</link>
      <description>&lt;P&gt;Furthermore, Is there any way that I can configure the errors lines to redirect to the event errors? &lt;/P&gt;

&lt;P&gt;Also, do you know how to format the field function to hide ".Error"  eg: showing just:  "EmailSettingsCorrection"&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8746i420D9B22F108E6AD/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 23:01:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/480997#M134780</guid>
      <dc:creator>felipesodre</dc:creator>
      <dc:date>2020-04-20T23:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a table with a count and distinct count using a field regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/480998#M134781</link>
      <description>&lt;P&gt;Check if you can use drill down to see actual events for each error. Check this: &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.3/Viz/DrilldownIntro"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.3/Viz/DrilldownIntro&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;To hide .Error use replace command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval Function=replace(Function, ".ERROR", "")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And please accept answer so that it can help others also.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 10:36:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/480998#M134781</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-04-21T10:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a table with a count and distinct count using a field regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/480999#M134782</link>
      <description>&lt;P&gt;Thank you all good! Please close the ticket.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 13:48:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/480999#M134782</guid>
      <dc:creator>felipesodre</dc:creator>
      <dc:date>2020-04-22T13:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a table with a count and distinct count using a field regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/481000#M134783</link>
      <description>&lt;P&gt;There are no "tickets" here as this is a community supported forum.  When you get a solution to your problem, click the "Accept" link to mark the question as resolved.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 14:31:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-a-table-with-a-count-and-distinct-count-using-a/m-p/481000#M134783</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-04-22T14:31:26Z</dc:date>
    </item>
  </channel>
</rss>

