<?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 Help with Search string count in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-string-count/m-p/106888#M183284</link>
    <description>&lt;P&gt;I am trying to extract a string, count how many times it appears and group it by host.&lt;/P&gt;

&lt;P&gt;RAW LOG:&lt;BR /&gt;&lt;BR /&gt;
[2013-01-31T03:55:06.739-06:00] [soa_server2] [ERROR] [] [oracle.soa.bpel.engine.dispatch] [tid: orabpel.invoke.pool-4.thread-16] [userId: &lt;ANONYMOUS&gt;] [ecid: b5e97102d2ab8130:-37493125:13c69c08931:-8000-00000000003946d4,0] [APP: soa-infra] failed to handle message[[&lt;STRONG&gt;ORABPEL-09705&lt;/STRONG&gt; Could not initialize variable.An error occurs while initializing BPEL variable inputVariable; the schema processor cannot find the element &lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
Search Expression:&lt;BR /&gt;&lt;/ANONYMOUS&gt;&lt;/P&gt;

&lt;P&gt;host="stiint2app2" OR host="stiint2app1" | chart count(ORABPEL-05002) AS ERROR:ORABPEL-05002,&lt;BR /&gt;
count(ORABPEL-09705) AS ERROR:ORABPEL-09705,&lt;BR /&gt;
count(ORABPEL-35009) AS ERROR:ORABPEL-35009,&lt;BR /&gt;
count(ORABPEL-9732) AS ERROR:ORABPEL-9732  by host&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;

&lt;P&gt;Results:&lt;BR /&gt;&lt;BR /&gt;
host           &lt;STRONG&gt;ERROR:ORABPEL-05002&lt;/STRONG&gt;  &lt;STRONG&gt;ERROR:ORABPEL-09705&lt;/STRONG&gt;  &lt;STRONG&gt;ERROR:ORABPEL-35009&lt;/STRONG&gt;  &lt;STRONG&gt;ERROR:ORABPEL-9732&lt;/STRONG&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;
1 stiint2app1       0                       0                     0                    0 &lt;BR /&gt;&lt;BR /&gt;
2 stiint2app2       0                       0                     0                    0 &lt;/P&gt;

&lt;P&gt;Currently I am not getting the exact results that I am looking for.  Example I have actual count of 37 occurences for ORABPEL-09705, today but my results show 0.&lt;/P&gt;</description>
    <pubDate>Thu, 31 Jan 2013 19:02:35 GMT</pubDate>
    <dc:creator>D01033778</dc:creator>
    <dc:date>2013-01-31T19:02:35Z</dc:date>
    <item>
      <title>Help with Search string count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-string-count/m-p/106888#M183284</link>
      <description>&lt;P&gt;I am trying to extract a string, count how many times it appears and group it by host.&lt;/P&gt;

&lt;P&gt;RAW LOG:&lt;BR /&gt;&lt;BR /&gt;
[2013-01-31T03:55:06.739-06:00] [soa_server2] [ERROR] [] [oracle.soa.bpel.engine.dispatch] [tid: orabpel.invoke.pool-4.thread-16] [userId: &lt;ANONYMOUS&gt;] [ecid: b5e97102d2ab8130:-37493125:13c69c08931:-8000-00000000003946d4,0] [APP: soa-infra] failed to handle message[[&lt;STRONG&gt;ORABPEL-09705&lt;/STRONG&gt; Could not initialize variable.An error occurs while initializing BPEL variable inputVariable; the schema processor cannot find the element &lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
Search Expression:&lt;BR /&gt;&lt;/ANONYMOUS&gt;&lt;/P&gt;

&lt;P&gt;host="stiint2app2" OR host="stiint2app1" | chart count(ORABPEL-05002) AS ERROR:ORABPEL-05002,&lt;BR /&gt;
count(ORABPEL-09705) AS ERROR:ORABPEL-09705,&lt;BR /&gt;
count(ORABPEL-35009) AS ERROR:ORABPEL-35009,&lt;BR /&gt;
count(ORABPEL-9732) AS ERROR:ORABPEL-9732  by host&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;

&lt;P&gt;Results:&lt;BR /&gt;&lt;BR /&gt;
host           &lt;STRONG&gt;ERROR:ORABPEL-05002&lt;/STRONG&gt;  &lt;STRONG&gt;ERROR:ORABPEL-09705&lt;/STRONG&gt;  &lt;STRONG&gt;ERROR:ORABPEL-35009&lt;/STRONG&gt;  &lt;STRONG&gt;ERROR:ORABPEL-9732&lt;/STRONG&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;
1 stiint2app1       0                       0                     0                    0 &lt;BR /&gt;&lt;BR /&gt;
2 stiint2app2       0                       0                     0                    0 &lt;/P&gt;

&lt;P&gt;Currently I am not getting the exact results that I am looking for.  Example I have actual count of 37 occurences for ORABPEL-09705, today but my results show 0.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2013 19:02:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-string-count/m-p/106888#M183284</guid>
      <dc:creator>D01033778</dc:creator>
      <dc:date>2013-01-31T19:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Search string count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-string-count/m-p/106889#M183285</link>
      <description>&lt;P&gt;Your syntax seems to a bit off. By the looks of it, it seems that you're assuming that count(blah) will match the raw log for "blah" and return the count of events where a match was found. This is not the case. count(blah) will count how many events the FIELD "blah" exists in. If you want to match something against the raw event, you'll want to do &lt;CODE&gt;count(eval(searchmatch("blah")))&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;So, with the query rewritten with those changes, it'll look something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host="stiint2app2" OR host="stiint2app1" | chart count(eval(searchmatch("ORABPEL-05002"))) AS ERROR:ORABPEL-05002, count(eval(searchmatch("ORABPEL-09705"))) AS ERROR:ORABPEL-09705, count(eval(searchmatch("ORABPEL-35009"))) AS ERROR:ORABPEL-35009, count(eval(searchmatch("ORABPEL-9732"))) AS ERROR:ORABPEL-9732 by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Personally I would go for a somewhat different approach - create a field extraction that matches the individual error ID's after the "ORABPEL-" string, so a field would be created (calling it ORABPEL seems appropriate) holding the various error ID's. Having done that, just doing&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host="stiint2app2" OR host="stiint2app1" | chart count by ORABPEL,host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;would suffice.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2013 19:36:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-string-count/m-p/106889#M183285</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-01-31T19:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Search string count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-string-count/m-p/106890#M183286</link>
      <description>&lt;P&gt;Are the arguments to the count() function field names or strings?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2013 19:37:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-string-count/m-p/106890#M183286</guid>
      <dc:creator>stefandagerman</dc:creator>
      <dc:date>2013-01-31T19:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Search string count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-string-count/m-p/106891#M183287</link>
      <description>&lt;P&gt;Thanks for much.  The first example works like a charm.  I will look into creating the field extraction as well.&lt;/P&gt;

&lt;P&gt;Thanks Again.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2013 19:55:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-string-count/m-p/106891#M183287</guid>
      <dc:creator>D01033778</dc:creator>
      <dc:date>2013-01-31T19:55:44Z</dc:date>
    </item>
  </channel>
</rss>

