<?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: Can you help me extract fields from apache:access logs? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Can-you-help-me-extract-fields-from-apache-access-logs/m-p/427815#M7633</link>
    <description>&lt;P&gt;thanks for your help!&lt;/P&gt;</description>
    <pubDate>Wed, 17 Oct 2018 19:11:31 GMT</pubDate>
    <dc:creator>mrtolu6</dc:creator>
    <dc:date>2018-10-17T19:11:31Z</dc:date>
    <item>
      <title>Can you help me extract fields from apache:access logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-you-help-me-extract-fields-from-apache-access-logs/m-p/427810#M7628</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Regex Experts!&lt;BR /&gt;
Need help in extracting src, http_method, uri_path, status  field.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Below is an example of a log with the fields that I would like to extract :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"10.10.10.22 - - [12/Oct/2012:14:22:41 -0400] "GET /etc/team/transport/tRoom?serlet=jpsSSGenerator HTTP/1.1" 200 26494"
src=10.10.10.22, http_method=GET, uri_path= /etc/team/transport/Room?serlet=jpsSSGenerator
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;This is example of different types of logs that comes from apache access logs.  I'm looking for a regex that can extract fields from the example below.  Thanks in advance for any help.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;example logs&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;127.0.0.1 - - [104/Oct/2018:11:22:47 -0700] "GET /directory/directory/test?seat=ShowPage&amp;amp;tese=calendar.js&amp;amp;IP=444.444.1.444 HTTP/1.1" 304 - "htttps://testwebsite.com/m/see/yup/Union?selpt=stepReportFilter.jsp" "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko"

10.10.10.10 - - [10/Oct/2018:11:22:47 -0700] "POST /nba/nfl/nhl/ufc HTTP/1.1" 200 470 "-" "Mozilla/4.0 (Windows 8.1 6.3) Java/1.2.0_181" "10.10.10.02"

dnsname..cod.blackops.com:80 10.10.10.02 - - [16/Oct/2018:11:22:22 -0700] "GET /scripts/form_registry.js HTTP/1.1" 200 2504 "htttp://10.10.10.03lnba/cruisehtml?&amp;amp;swf_version=ezboard052614_1&amp;amp;serverUrl=110.10.10.03&amp;amp;boardId=19-153970030&amp;amp;isPreview=0&amp;amp;update052109=1" "Mozilla/5.0 (Windows NT 6.1; Trident/2.0; rv:11.0) like Gecko"

10.10.10.02 - - [12/Oct/2018:13:22:41 -0500] "POST /yup/zillow/server.php?a=c7355 HTTP/1.1" 200 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/515.2 (KHTML, like Gecko) Chrome/15.0.200.200 Safari/535.2"

10.10.10.02 - - [11/Oct/2018:13:22:41 -0500] "POST /yup/zillow/server.php?a=c7355 HTTP/1.1" 200 - 

10.10.10.22 - - [12/Oct/2012:14:22:41 -0400] "GET /etc/team/transport/tRoom?serlet=jpsSSGenerator HTTP/1.1" 200 26494
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:37:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-you-help-me-extract-fields-from-apache-access-logs/m-p/427810#M7628</guid>
      <dc:creator>mrtolu6</dc:creator>
      <dc:date>2020-09-29T21:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me extract fields from apache:access logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-you-help-me-extract-fields-from-apache-access-logs/m-p/427811#M7629</link>
      <description>&lt;P&gt;Hi @mrtolu6,&lt;/P&gt;

&lt;P&gt;Give this regex a try: &lt;CODE&gt;your base search | rex field=_raw (?&amp;lt;src&amp;gt;\d+\.\d+\.\d+\.\d+).+\]\s\"(?&amp;lt;http_method&amp;gt;\w+)\s(?&amp;lt;uri_path&amp;gt;.+)\"\s(?&amp;lt;status&amp;gt;\d+)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Tested the regex here&lt;A href="https://regex101.com/r/CpQ56P/1"&gt;1&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 23:07:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-you-help-me-extract-fields-from-apache-access-logs/m-p/427811#M7629</guid>
      <dc:creator>sudosplunk</dc:creator>
      <dc:date>2018-10-16T23:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me extract fields from apache:access logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-you-help-me-extract-fields-from-apache-access-logs/m-p/427812#M7630</link>
      <description>&lt;P&gt;why not use the pre-built sourcetype &lt;CODE&gt;access_combined&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;see here:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.0/Data/Listofpretrainedsourcetypes"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.0/Data/Listofpretrainedsourcetypes&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 23:49:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-you-help-me-extract-fields-from-apache-access-logs/m-p/427812#M7630</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-10-16T23:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me extract fields from apache:access logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-you-help-me-extract-fields-from-apache-access-logs/m-p/427813#M7631</link>
      <description>&lt;P&gt;that worked but it adds extra details in the uri_path fields. If i wanted to created additional fields  called uri_query that would create a new field for anything after the "?", also would like to create a version field forhe HTTP1/1 called version.&lt;/P&gt;

&lt;P&gt;For example &lt;BR /&gt;
10.10.10.04 - - [07/Oct/23:08:30:59 -0400] "POST /OndnForm/drag_Form?images/ HTTP/1.1" 400 226 "-" "Hello, People"&lt;/P&gt;

&lt;P&gt;the uri_query=images/&lt;BR /&gt;
version= HTTP/1.1&lt;BR /&gt;
src=10.10.10.04&lt;BR /&gt;
status=400&lt;BR /&gt;
bytes=226&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:38:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-you-help-me-extract-fields-from-apache-access-logs/m-p/427813#M7631</guid>
      <dc:creator>mrtolu6</dc:creator>
      <dc:date>2020-09-29T21:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me extract fields from apache:access logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-you-help-me-extract-fields-from-apache-access-logs/m-p/427814#M7632</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex field=_raw "(?&amp;lt;src&amp;gt;\d+\.\d+\.\d+\.\d+).+\]\s\"(?&amp;lt;http_method&amp;gt;\w+)\s(?&amp;lt;uri_path&amp;gt;\S+)\s(?&amp;lt;uri_query&amp;gt;\S+)\"\s(?&amp;lt;status&amp;gt;\d+)\s(?&amp;lt;bytes&amp;gt;[\d-]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Updated &lt;A href="https://regex101.com/r/CpQ56P/2"&gt;regex&lt;/A&gt; &lt;A href="https://regex101.com/r/CpQ56P/2"&gt;https://regex101.com/r/CpQ56P/2&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 13:31:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-you-help-me-extract-fields-from-apache-access-logs/m-p/427814#M7632</guid>
      <dc:creator>sudosplunk</dc:creator>
      <dc:date>2018-10-17T13:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me extract fields from apache:access logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-you-help-me-extract-fields-from-apache-access-logs/m-p/427815#M7633</link>
      <description>&lt;P&gt;thanks for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 19:11:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-you-help-me-extract-fields-from-apache-access-logs/m-p/427815#M7633</guid>
      <dc:creator>mrtolu6</dc:creator>
      <dc:date>2018-10-17T19:11:31Z</dc:date>
    </item>
  </channel>
</rss>

