<?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: [beginner] Provide simple stat with different string from the field _raw in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147669#M41262</link>
    <description>&lt;P&gt;Steel not working. How can you catch the different type of events without use INFO, ERROR, WARN it in the regexe ?&lt;/P&gt;

&lt;P&gt;(Because i told you the _raw are like that &lt;BR /&gt;
text ERROR text&lt;BR /&gt;
text ERROR text&lt;BR /&gt;
text INFO text&lt;BR /&gt;
text WARN text)&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jun 2015 16:15:46 GMT</pubDate>
    <dc:creator>chrispappo</dc:creator>
    <dc:date>2015-06-10T16:15:46Z</dc:date>
    <item>
      <title>[beginner] Provide simple stat with different string from the field _raw</title>
      <link>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147666#M41259</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;if I have some logs like this:&lt;BR /&gt;
ID DATE            _RAW&lt;BR /&gt;
1  10/06/2015 text .. ERROR text...&lt;BR /&gt;
2  10/06/2015 text .. ERROR text...&lt;BR /&gt;
3  10/06/2015 text .. INFO text...&lt;BR /&gt;
4  10/06/2015 text .. WARN text...&lt;/P&gt;

&lt;P&gt;With that, I would like to find the right commande to provide me somethig like that&lt;/P&gt;

&lt;P&gt;ID        |    ERROR| INFO| WARN &lt;BR /&gt;
1      |            1    |   0      |      0&lt;BR /&gt;
2   |                1   |    0     |      0&lt;BR /&gt;
3     |              0   |    1     |      0&lt;BR /&gt;
4      |             0   |    0     |      1 &lt;/P&gt;

&lt;P&gt;So that count the number of ERROR, INFO, WARN for each ID. My main problem is that their is &lt;STRONG&gt;any field  who detect the type of the event ERROR, INFO, WARN&lt;/STRONG&gt; so I have to match it in the _raw field. I guess i have to use some regex but I can't find the good combination.&lt;/P&gt;

&lt;P&gt;Is someone can help me ? &lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 14:55:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147666#M41259</guid>
      <dc:creator>chrispappo</dc:creator>
      <dc:date>2015-06-10T14:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: [beginner] Provide simple stat with different string from the field _raw</title>
      <link>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147667#M41260</link>
      <description>&lt;P&gt;Here you go! &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=...|rex field=_raw "^\S+(?&amp;lt;myfield&amp;gt;\w+)\s+"|stats count as totalcount values(ID) as ID by myfield|table ID myfield totalcount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is not optimal but it can help&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 15:45:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147667#M41260</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-06-10T15:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: [beginner] Provide simple stat with different string from the field _raw</title>
      <link>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147668#M41261</link>
      <description>&lt;P&gt;please add your comment under the answer.&lt;/P&gt;

&lt;P&gt;ok i think i have updated my query. Test it again, and let me know&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 16:02:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147668#M41261</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-06-10T16:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: [beginner] Provide simple stat with different string from the field _raw</title>
      <link>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147669#M41262</link>
      <description>&lt;P&gt;Steel not working. How can you catch the different type of events without use INFO, ERROR, WARN it in the regexe ?&lt;/P&gt;

&lt;P&gt;(Because i told you the _raw are like that &lt;BR /&gt;
text ERROR text&lt;BR /&gt;
text ERROR text&lt;BR /&gt;
text INFO text&lt;BR /&gt;
text WARN text)&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 16:15:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147669#M41262</guid>
      <dc:creator>chrispappo</dc:creator>
      <dc:date>2015-06-10T16:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: [beginner] Provide simple stat with different string from the field _raw</title>
      <link>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147670#M41263</link>
      <description>&lt;P&gt;test this and let me know if your values are extracted.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;         index=...|rex field=_raw "[^\n]+\s+(?&amp;lt;myfield&amp;gt;\w+)\s+"|table myfield
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if not working, let me get a sample event please.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 16:20:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147670#M41263</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-06-10T16:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: [beginner] Provide simple stat with different string from the field _raw</title>
      <link>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147671#M41264</link>
      <description>&lt;P&gt;it's like that, in bold this is the field ID. The information I want is for each ID how many INFO, ERROR and WARN&lt;/P&gt;

&lt;P&gt;2015-06-10 17:20:37,838 [Thread] INFO  &lt;STRONG&gt;c.b.w.a.c.AbstractRepository&lt;/STRONG&gt; - SE_USE_TTL was not specified. Defaulting to: false&lt;/P&gt;

&lt;P&gt;2015-06-10 17:21:37,838 [Thread] ERROR &lt;STRONG&gt;c.b.w.a.c.AbstractRepository&lt;/STRONG&gt; - SE_USE_TTL was not specified. Defaulting to: false&lt;/P&gt;

&lt;P&gt;2015-06-10 17:22:37,838 [Thread] WARN &lt;STRONG&gt;c.b.w.a.c.AbstractRepository&lt;/STRONG&gt; - SE_USE_TTL was not specified. Defaulting to: trye&lt;/P&gt;

&lt;P&gt;many thanks&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 20:12:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147671#M41264</guid>
      <dc:creator>chrispappo</dc:creator>
      <dc:date>2020-09-28T20:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: [beginner] Provide simple stat with different string from the field _raw</title>
      <link>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147672#M41265</link>
      <description>&lt;P&gt;Means, you also need to extrac the ID field. Here you go for the extraction:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...|rex field=_raw "\]\s+(?&amp;lt;informations&amp;gt;\S+)\s+(?&amp;lt;ID&amp;gt;[^\-]+)"|table ID informations 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jun 2015 16:43:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147672#M41265</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-06-10T16:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: [beginner] Provide simple stat with different string from the field _raw</title>
      <link>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147673#M41266</link>
      <description>&lt;P&gt;I think it works i just re work the command like that &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=source | rex field=_raw "\]\s+(?&amp;lt;informations&amp;gt;\S+)\s+(?&amp;lt;ID&amp;gt;[^\-]+)"| chart count over ID by informations
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks :). But if one day the words INFO, ERROR or WARN are not followed anymore by the ID, it will not work isn't ? &lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 16:52:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147673#M41266</guid>
      <dc:creator>chrispappo</dc:creator>
      <dc:date>2015-06-10T16:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: [beginner] Provide simple stat with different string from the field _raw</title>
      <link>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147674#M41267</link>
      <description>&lt;P&gt;. My regex just means, after &lt;CODE&gt;]&lt;/CODE&gt;extract the &lt;CODE&gt;informations&lt;/CODE&gt;field, and after that field, take all caracters, except the &lt;CODE&gt;-&lt;/CODE&gt;, and create a &lt;CODE&gt;ID&lt;/CODE&gt; field with that values.&lt;/P&gt;

&lt;P&gt;This means that, if &lt;STRONG&gt;INFO, ERROR or WARN&lt;/STRONG&gt; are not followed by &lt;STRONG&gt;ID&lt;/STRONG&gt;, the &lt;STRONG&gt;informations&lt;/STRONG&gt; field will still be extracted, but the &lt;STRONG&gt;ID&lt;/STRONG&gt; field will be populated with wrong values&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Do not forget to accept the answer, if are satisfy .&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 07:10:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/beginner-Provide-simple-stat-with-different-string-from-the/m-p/147674#M41267</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-06-11T07:10:42Z</dc:date>
    </item>
  </channel>
</rss>

