<?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 write the regex for transforms.conf to extract fields and assign the proper sourcetype for my sample log format? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-transforms-conf-to-extract-fields-and/m-p/157365#M44294</link>
    <description>&lt;P&gt;Thank you so much, i have added the below in transforms.conf and its working fine,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = ^(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+[[access-request]]\s+[[qstring:useragent]]\s+(?[\S]+)\s+(?[\S]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 10 Aug 2015 15:34:10 GMT</pubDate>
    <dc:creator>dhavamanis</dc:creator>
    <dc:date>2015-08-10T15:34:10Z</dc:date>
    <item>
      <title>How to write the regex for transforms.conf to extract fields and assign the proper sourcetype for my sample log format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-transforms-conf-to-extract-fields-and/m-p/157362#M44291</link>
      <description>&lt;P&gt;Need your help,&lt;/P&gt;

&lt;P&gt;We have this below format of log and need to assign sourcetype to extract the fields, can you please provide the working regex to include this in transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2015-08-07T18:59:32.388226Z pnews-api 1.1.2.1:5681 10.4.0.81:8081 0.000049 0.002743 0.000021 200 200 0 686 "GET https://xyz.xyz.com:443/news-content/ HTTP/1.1" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0; GomezAgent 3.0) Gecko/20100101 Firefox/24.0" ECDHE-RSA-AES128-SHA TLSv1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;fields:&lt;/P&gt;

&lt;P&gt;timestamp&lt;BR /&gt;
elb&lt;BR /&gt;
client&lt;BR /&gt;
backend&lt;BR /&gt;
request_processing_time&lt;BR /&gt;
backend_processing_time&lt;BR /&gt;
response_processing_time&lt;BR /&gt;
elb_status_code&lt;BR /&gt;
backend_status_code&lt;BR /&gt;
received_bytes&lt;BR /&gt;
sent_bytes&lt;BR /&gt;
request&lt;BR /&gt;
user_agent&lt;BR /&gt;
ssl_cipher&lt;BR /&gt;
ssl_protocol&lt;/P&gt;

&lt;P&gt;I have tried this, seems somehow its not working for me,&lt;/P&gt;

&lt;P&gt;transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[s3-access-extractions]
REGEX = ^[[nspaces:req_time]]\s++[[nspaces:elb]]\s++[[nspaces:client]]\s++[[sbstring:backend]]\s++[[nspaces:request_processing_time]]\s++[[nspaces:backend_processing_time]]\s++[[nspaces:response_processing_time]]\s++[[nspaces:elb_status_code]]\s++[[nspaces:backend_status_code]]\s++[[nspaces:received_bytes]]\s++[[nspaces:sent_bytes]]\s++[[access-request]](?:\s++[[qstring:useragent]]\s++[[nspaces:ssl_cipher]]\s++[[nspaces:ssl_protocol]]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[s3_access_combined]
REPORT-access = s3-access-extractions
SHOULD_LINEMERGE = false
TIME_FORMAT = %Y-%m-%dT%H:%M:%S.%6NZ
EVAL-date_hour = strftime(_time,"%H")
EVAL-date_mday = strftime(_time,"%d")
EVAL-date_minute = strftime(_time,"%M")
EVAL-date_month = strftime(_time,"%m")
EVAL-date_second = strftime(_time,"%S")
EVAL-date_wday = strftime(_time,"%A")
EVAL-date_year = strftime(_time,"%Y")
category = Custom
pulldown_type = true

[rule::s3_access_combined]
sourcetype = s3_access_combined
MORE_THAN_75 = ^\S+ \S+ \S+ \S* ?\[[^\]]+\] "[^"]*" \S+ \S+ \S+ "[^"]*"$
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:53:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-transforms-conf-to-extract-fields-and/m-p/157362#M44291</guid>
      <dc:creator>dhavamanis</dc:creator>
      <dc:date>2020-09-29T06:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex for transforms.conf to extract fields and assign the proper sourcetype for my sample log format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-transforms-conf-to-extract-fields-and/m-p/157363#M44292</link>
      <description>&lt;P&gt;Put in props.conf , with sourcetype s3_access_combined&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[s3_access_combined]&lt;BR /&gt;
EXTRACT-elb,client,backend,request_processing_time,backend_processing_time,response_processing_time,elb_status_code,backend_status_code,received_bytes,sent_bytes,request,user_agent,ssl_cipher,ssl_protocol = ^[^ \n]* (?P[^ ]+)[^ \n]* (?P[^ ]+)[^ \n]* (?P[^ ]+)\s+(?P[^ ]+)[^ \n]* (?P\d+\.\d+)\s+(?P\d+\.\d+)\s+(?P[^ ]+)[^ \n]* (?P\d+)[^ \n]* (?P\d+)[^ \n]* (?P[^ ]+)[^ \n]* "(?P[^"]+)"\s+"(?P[^"]+)[^"\n]*"\s+(?P[^ ]+)\s+(?P.+)&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:56:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-transforms-conf-to-extract-fields-and/m-p/157363#M44292</guid>
      <dc:creator>jnussbaum_splun</dc:creator>
      <dc:date>2020-09-29T06:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex for transforms.conf to extract fields and assign the proper sourcetype for my sample log format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-transforms-conf-to-extract-fields-and/m-p/157364#M44293</link>
      <description>&lt;P&gt;Forget &lt;CODE&gt;transforms.conf&lt;/CODE&gt; for now and try this:&lt;/P&gt;

&lt;H3&gt;props.conf&lt;/H3&gt;

&lt;PRE&gt;&lt;CODE&gt;[s3_access_combined]
EXTRACT-s3-access-extractions = ^(?&amp;lt;req_time&amp;gt;[\S]+)\s+(?&amp;lt;elb&amp;gt;[\S]+)\s+(?&amp;lt;client&amp;gt;[\S]+)\s+(?&amp;lt;backend&amp;gt;[\S]+)\s+(?&amp;lt;request_processing_time&amp;gt;[\S]+)\s+(?&amp;lt;backend_processing_time&amp;gt;[\S]+)\s+(?&amp;lt;response_processing_time&amp;gt;[\S]+)\s+(?&amp;lt;elb_status_code&amp;gt;[\S]+)\s+(?&amp;lt;backend_status_code&amp;gt;[\S]+)\s+(?&amp;lt;received_bytes&amp;gt;[\S]+)\s+(?&amp;lt;sent_bytes&amp;gt;[\S]+)\s+"(?&amp;lt;access_request&amp;gt;[^"]+)"\s+"(?&amp;lt;useragent&amp;gt;[^"]+)"\s+(?&amp;lt;ssl_cipher&amp;gt;[\S]+)\s+(?&amp;lt;ssl_protocol&amp;gt;[\S]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 08 Aug 2015 01:29:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-transforms-conf-to-extract-fields-and/m-p/157364#M44293</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-08T01:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex for transforms.conf to extract fields and assign the proper sourcetype for my sample log format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-transforms-conf-to-extract-fields-and/m-p/157365#M44294</link>
      <description>&lt;P&gt;Thank you so much, i have added the below in transforms.conf and its working fine,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = ^(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+(?[\S]+)\s+[[access-request]]\s+[[qstring:useragent]]\s+(?[\S]+)\s+(?[\S]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Aug 2015 15:34:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-transforms-conf-to-extract-fields-and/m-p/157365#M44294</guid>
      <dc:creator>dhavamanis</dc:creator>
      <dc:date>2015-08-10T15:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex for transforms.conf to extract fields and assign the proper sourcetype for my sample log format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-transforms-conf-to-extract-fields-and/m-p/157366#M44295</link>
      <description>&lt;P&gt;what if the fields sequence changes..&lt;BR /&gt;
 2015-08-07T18:59:32.388226Z pnews-api 1.1.2.1:5681 10.4.0.81:8081 0.000049 0.002743 0.000021 200 200 0 686 "GET &lt;A href="https://xyz.xyz.com:443/news-content/"&gt;https://xyz.xyz.com:443/news-content/&lt;/A&gt; HTTP/1.1" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0; GomezAgent 3.0) Gecko/20100101 Firefox/24.0" ECDHE-RSA-AES128-SHA TLSv1&lt;/P&gt;

&lt;P&gt;2015-08-07T18:59:32.388226Z pnews-api Gecko/20100101 Firefox/24.0" ECDHE-RSA-AES128-SHA TLSv1 1.1.2.1:5681 10.4.0.81:8081 0.000049 0.002743 0.000021 200 200 0 686 "GET &lt;A href="https://xyz.xyz.com:443/news-content/"&gt;https://xyz.xyz.com:443/news-content/&lt;/A&gt; HTTP/1.1" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0; GomezAgent 3.0) &lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 07:51:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-transforms-conf-to-extract-fields-and/m-p/157366#M44295</guid>
      <dc:creator>AnilPujar</dc:creator>
      <dc:date>2018-11-07T07:51:35Z</dc:date>
    </item>
  </channel>
</rss>

