<?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: Field value count in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109150#M28467</link>
    <description>&lt;P&gt;The following search:&lt;BR /&gt;
sourcetype="answerstest" | rex field=PROJ_NAME "(?&lt;PROJ&gt;.*)[-_]" | contingency STATUS, PROJ&lt;/PROJ&gt;&lt;/P&gt;

&lt;P&gt;uses a regex to pull out the prefix of the PROJ_NAME field and create a new field called PROJ which is used in the results table (which should match your second example)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    STATUS          WIWEB   PI  DC  TOTAL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;1   PASSED          3   1   0   4&lt;BR /&gt;
2   FAILED          1   0   2   3&lt;BR /&gt;
3   CANCELLED   0   2   0   2&lt;BR /&gt;
4   SKIPPED         1   0   0   1&lt;BR /&gt;
5   TOTAL           5   3   2   10&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 10:07:21 GMT</pubDate>
    <dc:creator>eelisio2</dc:creator>
    <dc:date>2020-09-28T10:07:21Z</dc:date>
    <item>
      <title>Field value count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109145#M28462</link>
      <description>&lt;P&gt;csv log file data&lt;/P&gt;

&lt;H2&gt;PROJ_NAME                 TAG_NAME                   STATUS&lt;/H2&gt;

&lt;P&gt;WIWEB-A                 WIWEB-A_1                    PASSED&lt;BR /&gt;
WIWEB-A                 WIWEB-A_2                    FAILED&lt;BR /&gt;
WIWEB-A                 WIWEB-A_3                    PASSED&lt;BR /&gt;
WIWEB-B                 WIWEB-B_1                    PASSED&lt;BR /&gt;&lt;BR /&gt;
WIWEB-C                 WIWEB-C_1                    SKIPPED&lt;BR /&gt;
PI-A                    PI-A_1                       CANCELLED&lt;BR /&gt;
PI-A                    PI-A_2                       PASSED&lt;BR /&gt;
PI_B                    PI-A_1                       CANCELLED&lt;BR /&gt;&lt;BR /&gt;
DC_A                    DC_A_1                       FAILED &lt;BR /&gt;
DC_B                    DC_B_1                       FAILED&lt;/P&gt;

&lt;P&gt;We are expecting the results to come in the below format.&lt;/P&gt;

&lt;P&gt;1)&lt;/P&gt;

&lt;H2&gt;PROJ              COUNT&lt;/H2&gt;

&lt;P&gt;WIWEB*             5&lt;BR /&gt;
PI*                3&lt;BR /&gt;
DC*                2&lt;/P&gt;

&lt;P&gt;2)&lt;/P&gt;

&lt;H2&gt;STATUS              WIWEB             PI            DC&lt;/H2&gt;

&lt;P&gt;PASSED               3                 1             0&lt;BR /&gt;
FAILED               1                 0             2&lt;BR /&gt;
CANCELLED            0                 2             0&lt;BR /&gt;
SKIPPED              1                 0             0&lt;/P&gt;

&lt;P&gt;can you please suggest queries for the above two report formats?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:06:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109145#M28462</guid>
      <dc:creator>iamniks</dc:creator>
      <dc:date>2020-09-28T10:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: Field value count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109146#M28463</link>
      <description>&lt;P&gt;Using your fieldnames above, the first table should be:&lt;BR /&gt;
sourcetype="yoursourcetype" | rex field=PROJ_NAME "(?&lt;PROJ&gt;.*)[-_]" | stats count by PROJ&lt;/PROJ&gt;&lt;/P&gt;

&lt;P&gt;For the second table:&lt;BR /&gt;
sourcetype="yoursourcetype" | rex field=PROJ_NAME "(?&lt;PROJ&gt;.*)[-_]" | stats count by STATUS, PROJ | xyseries STATUS PROJ count&lt;/PROJ&gt;&lt;/P&gt;

&lt;P&gt;or&lt;BR /&gt;
sourcetype="yoursourcetype" | rex field=PROJ_NAME "(?&lt;PROJ&gt;.*)[-_]" | contingency STATUS, PROJ &lt;BR /&gt;
You'll get row and column totals automatically.&lt;/PROJ&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:06:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109146#M28463</guid>
      <dc:creator>eelisio2</dc:creator>
      <dc:date>2020-09-28T10:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: Field value count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109147#M28464</link>
      <description>&lt;P&gt;Make sure PROJ is upper case within the angle brackets in the rex command. There was an issue with the pasted text.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2011 14:31:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109147#M28464</guid>
      <dc:creator>eelisio2</dc:creator>
      <dc:date>2011-11-16T14:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Field value count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109148#M28465</link>
      <description>&lt;P&gt;Hi, thanks for the reply.  However, we would like to group the value in PROJ_NAME field such as all value starting with WIWEB... as group-1, all DC.... as group-2, all PI... as group-3.&lt;BR /&gt;
Then have count from TAT_NAME filed group wise along with count of status for that group.&lt;/P&gt;

&lt;P&gt;Name:     total&lt;BR /&gt;
group-1   5&lt;BR /&gt;
group-2   3&lt;BR /&gt;
group-3   2&lt;/P&gt;

&lt;P&gt;status:    group-1   group-2  group-3&lt;BR /&gt;
passed      3         1          0&lt;BR /&gt;
failed      1          0          2&lt;/P&gt;

&lt;P&gt;Hope this clarifies.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:07:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109148#M28465</guid>
      <dc:creator>iamniks</dc:creator>
      <dc:date>2020-09-28T10:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Field value count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109149#M28466</link>
      <description>&lt;P&gt;I used the following data to test.&lt;BR /&gt;
11/16/11 8:58:09.000 AM, WIWEB-A, WIWEB-A_1, PASSED&lt;BR /&gt;
11/16/11 8:58:09.000 AM, WIWEB-A, WIWEB-A_2, FAILED&lt;BR /&gt;
11/16/11 8:58:09.000 AM, WIWEB-A, WIWEB-A_3, PASSED&lt;BR /&gt;
11/16/11 8:58:09.000 AM, WIWEB-B, WIWEB-B_1, PASSED&lt;BR /&gt;
11/16/11 8:58:09.000 AM, WIWEB-C, WIWEB-C_1, SKIPPED&lt;BR /&gt;
11/16/11 8:58:09.000 AM, PI-A, PI-A_1, CANCELLED&lt;BR /&gt;
11/16/11 8:58:09.000 AM, PI-A, PI-A_1, PASSED&lt;BR /&gt;
11/16/11 8:58:09.000 AM, PI-B, PI-B_1, CANCELLED&lt;BR /&gt;
11/16/11 8:58:09.000 AM, DC_A, DC_A_1, FAILED&lt;BR /&gt;
11/16/11 8:58:09.000 AM, DC_B, DC_B_1, FAILED&lt;/P&gt;

&lt;P&gt;i created field extractions to match your fieldnames.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:07:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109149#M28466</guid>
      <dc:creator>eelisio2</dc:creator>
      <dc:date>2020-09-28T10:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Field value count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109150#M28467</link>
      <description>&lt;P&gt;The following search:&lt;BR /&gt;
sourcetype="answerstest" | rex field=PROJ_NAME "(?&lt;PROJ&gt;.*)[-_]" | contingency STATUS, PROJ&lt;/PROJ&gt;&lt;/P&gt;

&lt;P&gt;uses a regex to pull out the prefix of the PROJ_NAME field and create a new field called PROJ which is used in the results table (which should match your second example)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    STATUS          WIWEB   PI  DC  TOTAL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;1   PASSED          3   1   0   4&lt;BR /&gt;
2   FAILED          1   0   2   3&lt;BR /&gt;
3   CANCELLED   0   2   0   2&lt;BR /&gt;
4   SKIPPED         1   0   0   1&lt;BR /&gt;
5   TOTAL           5   3   2   10&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:07:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109150#M28467</guid>
      <dc:creator>eelisio2</dc:creator>
      <dc:date>2020-09-28T10:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Field value count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109151#M28468</link>
      <description>&lt;P&gt;sourcetype="answerstest" | rex field=PROJ_NAME "(?&lt;PROJ&gt;.*)[-_]" | stats count by PROJ&lt;/PROJ&gt;&lt;/P&gt;

&lt;P&gt;yields the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    PROJ    count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;1   DC  2&lt;BR /&gt;
2   PI  3&lt;BR /&gt;
3   WIWEB   5&lt;/P&gt;

&lt;P&gt;Unfortunately, my cut and paste is being re-formatted.&lt;BR /&gt;
Again, make sure that PROJ is in upper case within the angle brackets that are in the rex command.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:07:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-value-count/m-p/109151#M28468</guid>
      <dc:creator>eelisio2</dc:creator>
      <dc:date>2020-09-28T10:07:23Z</dc:date>
    </item>
  </channel>
</rss>

