<?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: Nginx log parsing in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18625#M2734</link>
    <description>&lt;P&gt;First time I thought as you 8-) Nginx terms are strange sometimes, below the quote from Nginx docs:&lt;/P&gt;

&lt;P&gt;$request_time - request processing time in seconds with a milliseconds resolution; time elapsed between the first bytes were read from the client and the log write after the last bytes were sent to the client&lt;/P&gt;

&lt;P&gt;$msec - time in seconds with a milliseconds resolution at the time of log write&lt;/P&gt;</description>
    <pubDate>Thu, 05 Apr 2012 15:36:55 GMT</pubDate>
    <dc:creator>intachur</dc:creator>
    <dc:date>2012-04-05T15:36:55Z</dc:date>
    <item>
      <title>Nginx log parsing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18620#M2729</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;P&gt;I would like to extract fields from my &lt;A href="http://nginx.org/en/docs/http/ngx_http_log_module.html" target="_blank"&gt;nginx&lt;/A&gt; access log which was configured so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;'[ $connection : $msec : $request_time : $bytes_sent ] '
'$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now I need to extract $connection, $msec, $request_time, $bytes_sent and probably $remote_addr values to Splunk fields to make some analysis. Could you please anybody give me an input how I can do it? I guess I have to use Regexp (rex command), but I wasn't successful with this command &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;The sample of output is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ 533297 : 1333487468.121 : 1.170 : 380374 ] 127.0.0.0 - - [04/Apr/2012:01:11:08 +0400] "GET /data HTTP/1.1" 200 380136 "-" "-"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in advance&lt;BR /&gt;
Sergey&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:37:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18620#M2729</guid>
      <dc:creator>intachur</dc:creator>
      <dc:date>2020-09-28T11:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Nginx log parsing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18621#M2730</link>
      <description>&lt;P&gt;Have you tried the Interactive Field Extractor (IFX)?&lt;/P&gt;

&lt;P&gt;It's a wizard that can help you with your regex generation. Just look in the search app next to the timestamp of an event, there will be a sort of down-pointing arrow. Clicking it will give you the option to "Extract Fields". &lt;/P&gt;

&lt;P&gt;For more information, see&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/4.3.1/User/InteractiveFieldExtractionExample"&gt;http://docs.splunk.com/Documentation/Splunk/4.3.1/User/InteractiveFieldExtractionExample&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 17:43:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18621#M2730</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2012-04-04T17:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Nginx log parsing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18622#M2731</link>
      <description>&lt;P&gt;Yes, I tried but it didn't give me that I need &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 18:31:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18622#M2731</guid>
      <dc:creator>intachur</dc:creator>
      <dc:date>2012-04-04T18:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Nginx log parsing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18623#M2732</link>
      <description>&lt;P&gt;The question is closed &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; My regexp is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/var/log/nginx/access.log" | rex field=_raw "^\[\s+(?&amp;lt;connection&amp;gt;\d+)\s+:\s+(?&amp;lt;exec_time_msec&amp;gt;\d+.\d+)\s+:\s+(?&amp;lt;request_time&amp;gt;\d+.\d+)\s+:\s+(?&amp;lt;bytes_sent&amp;gt;\d+)\s+\]"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Apr 2012 07:47:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18623#M2732</guid>
      <dc:creator>intachur</dc:creator>
      <dc:date>2012-04-05T07:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: Nginx log parsing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18624#M2733</link>
      <description>&lt;P&gt;Are you sure tou haven't switched places between $msec and $request_time?&lt;/P&gt;

&lt;P&gt;1333487468.121 looks like epoch to me...and it matches the timestamp in event rather well.&lt;/P&gt;

&lt;P&gt;/k&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 08:54:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18624#M2733</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2012-04-05T08:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Nginx log parsing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18625#M2734</link>
      <description>&lt;P&gt;First time I thought as you 8-) Nginx terms are strange sometimes, below the quote from Nginx docs:&lt;/P&gt;

&lt;P&gt;$request_time - request processing time in seconds with a milliseconds resolution; time elapsed between the first bytes were read from the client and the log write after the last bytes were sent to the client&lt;/P&gt;

&lt;P&gt;$msec - time in seconds with a milliseconds resolution at the time of log write&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 15:36:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18625#M2734</guid>
      <dc:creator>intachur</dc:creator>
      <dc:date>2012-04-05T15:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Nginx log parsing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18626#M2735</link>
      <description>&lt;P&gt;i added in something similar.  our logs were same as the standard format &lt;A href="http://nginx.org/en/docs/http/ngx_http_log_module.html"&gt;described in the docs&lt;/A&gt;.  i didn't know / care about the last two fields, however i grouped them together for you for future reference (they could easily be whacked off).  note i also used their field names, rather than apache, squid, etc.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?P&amp;lt;remote_addr&amp;gt;[\d\.]+)\s-\s(?P&amp;lt;remote_user&amp;gt;\S+)\s\[.+\]\s+(?&amp;lt;request&amp;gt;.+\sHTTP/\d\.\d)\s(?P&amp;lt;status&amp;gt;\d+)\s(?P&amp;lt;bytes_sent&amp;gt;\d+)\s\"(?P&amp;lt;http_referer&amp;gt;[^\"]+)\"\s\"(?P&amp;lt;http_user_agent&amp;gt;[^\"]+)\"\s(\S+)\s(\S+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Dec 2014 04:38:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nginx-log-parsing/m-p/18626#M2735</guid>
      <dc:creator>awurster</dc:creator>
      <dc:date>2014-12-03T04:38:14Z</dc:date>
    </item>
  </channel>
</rss>

