<?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 apache log when field is undefined in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-apache-log-when-field-is-undefined/m-p/190373#M54809</link>
    <description>&lt;P&gt;We have some apache logs that I've added the %D (response time in microseconds) log config to at the very end.  The splunk configuration is not set up on these servers to match each field so the response time at the end is currently undefined.  Below is an example of the log output and the pipes are the field delimiters in apache, but the splunk config isn't using that.  &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;192.168.254.2|-|-|[05/Jun/2014:18:33:35 -0400]|"POST /order/app1/123 HTTP/1.0"|200|284|"-"|"Jakarta Commons-HttpClient"|2788571&lt;BR /&gt;
192.168.254.2|-|-|[05/Jun/2014:18:35:43 -0400]|"POST /order/app1/123 HTTP/1.0"|200|284|"-"|"Jakarta Commons-HttpClient"|3125614&lt;BR /&gt;
192.168.254.2|-|-|[05/Jun/2014:18:45:42 -0400]|"POST /order/app1/123 HTTP/1.0"|200|284|"-"|"Jakarta Commons-HttpClient"|2506712&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I've tried the following rex string and it returns search results.  However, if I add something like timechart avg(MicroSeconds) I get no data for the response times.  Is there anything I can do without modifying the splunk configuration on the server itself?  I'd like to avoid modifying the splunk config if possible.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype=access_combined POST | rex field=_raw "(?&amp;lt;response_time&amp;gt;\d([0-9]{6-12}))"&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Jun 2014 22:55:58 GMT</pubDate>
    <dc:creator>DFresh4130</dc:creator>
    <dc:date>2014-06-05T22:55:58Z</dc:date>
    <item>
      <title>Regex apache log when field is undefined</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-apache-log-when-field-is-undefined/m-p/190373#M54809</link>
      <description>&lt;P&gt;We have some apache logs that I've added the %D (response time in microseconds) log config to at the very end.  The splunk configuration is not set up on these servers to match each field so the response time at the end is currently undefined.  Below is an example of the log output and the pipes are the field delimiters in apache, but the splunk config isn't using that.  &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;192.168.254.2|-|-|[05/Jun/2014:18:33:35 -0400]|"POST /order/app1/123 HTTP/1.0"|200|284|"-"|"Jakarta Commons-HttpClient"|2788571&lt;BR /&gt;
192.168.254.2|-|-|[05/Jun/2014:18:35:43 -0400]|"POST /order/app1/123 HTTP/1.0"|200|284|"-"|"Jakarta Commons-HttpClient"|3125614&lt;BR /&gt;
192.168.254.2|-|-|[05/Jun/2014:18:45:42 -0400]|"POST /order/app1/123 HTTP/1.0"|200|284|"-"|"Jakarta Commons-HttpClient"|2506712&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I've tried the following rex string and it returns search results.  However, if I add something like timechart avg(MicroSeconds) I get no data for the response times.  Is there anything I can do without modifying the splunk configuration on the server itself?  I'd like to avoid modifying the splunk config if possible.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype=access_combined POST | rex field=_raw "(?&amp;lt;response_time&amp;gt;\d([0-9]{6-12}))"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jun 2014 22:55:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-apache-log-when-field-is-undefined/m-p/190373#M54809</guid>
      <dc:creator>DFresh4130</dc:creator>
      <dc:date>2014-06-05T22:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Regex apache log when field is undefined</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-apache-log-when-field-is-undefined/m-p/190374#M54810</link>
      <description>&lt;P&gt;You're close...&lt;BR /&gt;
But you have the {min,max} notation with the wrong delimiter&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
so you can use &lt;BR /&gt;
&lt;CODE&gt;(?&amp;lt;response_time&amp;gt;\d{6,12})&lt;/CODE&gt;&lt;BR /&gt;
or you can use &lt;BR /&gt;
&lt;CODE&gt; (?&amp;lt;response_time&amp;gt;[0-9]{6,12})&lt;/CODE&gt;&lt;BR /&gt;
or you can use &lt;BR /&gt;
&lt;CODE&gt; (?&amp;lt;response_time&amp;gt;\d([0-9]{6,12})&lt;/CODE&gt;&lt;BR /&gt;
And they will all grab the response time field for you... &lt;/P&gt;</description>
      <pubDate>Fri, 06 Jun 2014 07:15:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-apache-log-when-field-is-undefined/m-p/190374#M54810</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2014-06-06T07:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Regex apache log when field is undefined</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-apache-log-when-field-is-undefined/m-p/190375#M54811</link>
      <description>&lt;P&gt;I found my typo not long after posting this.  Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jun 2014 15:25:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-apache-log-when-field-is-undefined/m-p/190375#M54811</guid>
      <dc:creator>DFresh4130</dc:creator>
      <dc:date>2014-06-06T15:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Regex apache log when field is undefined</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-apache-log-when-field-is-undefined/m-p/190376#M54812</link>
      <description>&lt;P&gt;awesome. Would you mind "accepting" the answer? Otherwise, the question kind of hangs out in limbo. Glad you found your typo!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jun 2014 15:50:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-apache-log-when-field-is-undefined/m-p/190376#M54812</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2014-06-06T15:50:22Z</dc:date>
    </item>
  </channel>
</rss>

