<?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 Regex with eval ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-with-eval/m-p/378158#M171135</link>
    <description>&lt;P&gt;I have this following string &lt;/P&gt;

&lt;P&gt;2019-05-17 11:30:14.262  INFO 13 --- [pool-3-thread-1] com.abcd.efgh.ijk.statuspage.StatusPage  : Application[id=00, name='XYZ Service', environment='Production', status='DOWN'&lt;/P&gt;

&lt;P&gt;i just need to extract value against the name keyword and use it as a field to run stats against it .&lt;BR /&gt;
How can i extract the value ? Can someone plz help with the SPL ?  &lt;/P&gt;

&lt;H1&gt;justgettingstarted&lt;/H1&gt;</description>
    <pubDate>Fri, 17 May 2019 19:28:54 GMT</pubDate>
    <dc:creator>officialsubho</dc:creator>
    <dc:date>2019-05-17T19:28:54Z</dc:date>
    <item>
      <title>Regex with eval ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-with-eval/m-p/378158#M171135</link>
      <description>&lt;P&gt;I have this following string &lt;/P&gt;

&lt;P&gt;2019-05-17 11:30:14.262  INFO 13 --- [pool-3-thread-1] com.abcd.efgh.ijk.statuspage.StatusPage  : Application[id=00, name='XYZ Service', environment='Production', status='DOWN'&lt;/P&gt;

&lt;P&gt;i just need to extract value against the name keyword and use it as a field to run stats against it .&lt;BR /&gt;
How can i extract the value ? Can someone plz help with the SPL ?  &lt;/P&gt;

&lt;H1&gt;justgettingstarted&lt;/H1&gt;</description>
      <pubDate>Fri, 17 May 2019 19:28:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-with-eval/m-p/378158#M171135</guid>
      <dc:creator>officialsubho</dc:creator>
      <dc:date>2019-05-17T19:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: Regex with eval ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-with-eval/m-p/378159#M171136</link>
      <description>&lt;P&gt;I would have thought, Splunk automatically extracts it? &lt;/P&gt;

&lt;P&gt;Anyway, Please find the regex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults
| eval myraw="2019-05-17 11:30:14.262 INFO 13 --- [pool-3-thread-1] com.abcd.efgh.ijk.statuspage.StatusPage : Application[id=00, name='XYZ Service', environment='Production', status='DOWN'"
| rex field=myraw "name=\'(?&amp;lt;name&amp;gt;[^\']+)\'"
| fields name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In regex101 =&amp;gt; &lt;A href="https://regex101.com/r/yWXFJ7/1"&gt;https://regex101.com/r/yWXFJ7/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 20:36:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-with-eval/m-p/378159#M171136</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2019-05-17T20:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Regex with eval ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-with-eval/m-p/378160#M171137</link>
      <description>&lt;P&gt;Thanks @koshyk  , but i am not looking for the regex .&lt;BR /&gt;
i Just need store the name='XYZ Service' in a separate field , so that i can run counts against it .&lt;/P&gt;

&lt;P&gt;i am trying to figure out how many times a particular XYZ service showed down status on the logs .&lt;BR /&gt;
let me know if that makes sense .&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 19:27:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-with-eval/m-p/378160#M171137</guid>
      <dc:creator>officialsubho</dc:creator>
      <dc:date>2019-05-21T19:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Regex with eval ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-with-eval/m-p/378161#M171138</link>
      <description>&lt;P&gt;@officialsubho you can use this rex command &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; rex field=_raw "name=\'(?&amp;lt;name&amp;gt;[^\']+)\'"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 May 2019 19:48:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-with-eval/m-p/378161#M171138</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2019-05-21T19:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: Regex with eval ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-with-eval/m-p/378162#M171139</link>
      <description>&lt;P&gt;so you want the whole of &lt;CODE&gt;name='XYZ Service'&lt;/CODE&gt; to be in a separate field? &lt;/P&gt;

&lt;P&gt;In the above regex, you will get the field name as "name", but you can change it to whatever it suits you. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults
 | eval myraw="2019-05-17 11:30:14.262 INFO 13 --- [pool-3-thread-1] com.abcd.efgh.ijk.statuspage.StatusPage : Application[id=00, name='XYZ Service', environment='Production', status='DOWN'"
 | rex field=myraw "name=\'(?&amp;lt;myNewField&amp;gt;[^\']+)\'"
 | stats count by myNewField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;..&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 20:38:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-with-eval/m-p/378162#M171139</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2019-05-21T20:38:55Z</dc:date>
    </item>
  </channel>
</rss>

