<?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: How to extract data into a data model attribute regex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-data-into-a-data-model-attribute-regex/m-p/147929#M41359</link>
    <description>&lt;P&gt;I got an answer on Stack Overflow (or at least a satisfactory one).  The provided regex got me everything I wanted, but what appears between the log level and the hyphen.  Here it is:&lt;/P&gt;

&lt;P&gt;\S* \S* \S* \[.*\]\s+[A-Z]+\s+(\S+ - )(?:.+\| )?(?&amp;lt;message&amp;gt;.*)&lt;/P&gt;</description>
    <pubDate>Fri, 18 Jul 2014 20:29:57 GMT</pubDate>
    <dc:creator>robertpenberthy</dc:creator>
    <dc:date>2014-07-18T20:29:57Z</dc:date>
    <item>
      <title>How to extract data into a data model attribute regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-data-into-a-data-model-attribute-regex/m-p/147926#M41356</link>
      <description>&lt;P&gt;I'm trying to extract data into a Data Model Attribute Regex.  The data I'm trying to extract from the events get logged in a couple of ways.  I've been at this a while trying to just extract the data I want and have just about given up on figuring it out myself.&lt;/P&gt;

&lt;P&gt;2014-07-17 18:58:00,781 UTC [somedata] LEVEL java.class.information - &lt;STRONG&gt;data I want&lt;/STRONG&gt; &lt;BR /&gt;&lt;BR /&gt;
2014-07-17 18:58:00,781 UTC [somedata] LEVEL java.class.information - auto extracted fields | &lt;STRONG&gt;data I want&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;While the java class information would be great to include, I want to come up with an regex that will get the data I want from both ways of logging... excluding the auto extracted fields and the pipe that are present in some of the events.  I have come up with regex expressions that handle each situation separately, but not one that will handle both situations and put them into the same field.&lt;/P&gt;

&lt;P&gt;The latest idea that I was working on was to do a negative lookahead and extract the data that doesn't come before a pipe character.&lt;/P&gt;

&lt;P&gt;\S* \S* \S* \[.*\]\s+[A-Z]+\s+(?&amp;lt;message&amp;gt;.*(?!|))&lt;/P&gt;

&lt;P&gt;Every combination that I try either matches everything, nothing, or half of what I want.  So hopefully some regex master can assist me.&lt;/P&gt;

&lt;P&gt;In response to the request for actual data from the log files...&lt;/P&gt;

&lt;P&gt;2014-07-17 21:29:43,620 UTC [http-apr-8080-exec-143] ERROR c.s.b.b.s.impl.HttpRequestLogFilter - Apps="UNKNOWN" ReqIP="1.1.1.1" ReqProt="https" | FAILED: 500 POST /something/v1/something/v1/group elapsed:14&lt;/P&gt;

&lt;P&gt;2014-07-17 21:29:42,797 UTC [persistentScheduler_Worker-6] INFO c.s.b.s.b.svc.impl.DocumentIndexJob - data source UNKNOWN_163_2 (Customer Information), customer 1, institution 1 is still indexing&lt;/P&gt;

&lt;P&gt;I would love it if the regular expression would return the following values from the two lines:&lt;/P&gt;

&lt;P&gt;c.s.b.b.s.impl.HttpRequestLogFilter - FAILED: 500 POST /something/v1/something/v1/group elapsed:14&lt;BR /&gt;&lt;BR /&gt;
c.s.b.s.b.svc.impl.DocumentIndexJob - data source UNKNOWN_163_2 (Customer Information), customer 1, institution 1 is still indexing&lt;/P&gt;

&lt;P&gt;Aside from my attempt to have the one statement work, these different regex I have used for each case individually:&lt;/P&gt;

&lt;P&gt;Pulling everything after the pipe character:&lt;/P&gt;

&lt;P&gt;\S* \S* \S* \[.*\]\s+[A-Z]+\s+.*\|(?&amp;lt;message&amp;gt;.*)&lt;/P&gt;

&lt;P&gt;Pulling everything without a pipe character:&lt;/P&gt;

&lt;P&gt;\S* \S* \S* \[.*\]\s+[A-Z]+\s+(.*||(?&amp;lt;message&amp;gt;.*))&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2014 20:48:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-data-into-a-data-model-attribute-regex/m-p/147926#M41356</guid>
      <dc:creator>robertpenberthy</dc:creator>
      <dc:date>2014-07-17T20:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract data into a data model attribute regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-data-into-a-data-model-attribute-regex/m-p/147927#M41357</link>
      <description>&lt;P&gt;Could you provide more sample data, if possible actual data (just mask sensitive parts) and the regex you currently have for each of the case.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2014 16:59:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-data-into-a-data-model-attribute-regex/m-p/147927#M41357</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-18T16:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract data into a data model attribute regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-data-into-a-data-model-attribute-regex/m-p/147928#M41358</link>
      <description>&lt;P&gt;Hopefully provided the information you requested.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2014 17:23:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-data-into-a-data-model-attribute-regex/m-p/147928#M41358</guid>
      <dc:creator>robertpenberthy</dc:creator>
      <dc:date>2014-07-18T17:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract data into a data model attribute regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-data-into-a-data-model-attribute-regex/m-p/147929#M41359</link>
      <description>&lt;P&gt;I got an answer on Stack Overflow (or at least a satisfactory one).  The provided regex got me everything I wanted, but what appears between the log level and the hyphen.  Here it is:&lt;/P&gt;

&lt;P&gt;\S* \S* \S* \[.*\]\s+[A-Z]+\s+(\S+ - )(?:.+\| )?(?&amp;lt;message&amp;gt;.*)&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2014 20:29:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-data-into-a-data-model-attribute-regex/m-p/147929#M41359</guid>
      <dc:creator>robertpenberthy</dc:creator>
      <dc:date>2014-07-18T20:29:57Z</dc:date>
    </item>
  </channel>
</rss>

