Logstash grok analysis Nginx Access log

Source: Internet
Author: User
Tags logstash

To facilitate quantitative analysis of nginx access logs, filter matches using logstash  1. Determine nginx  log format     log_format  access  ' $remote _addr -  $remote _user [$time _local]  '                 ' $http _host  $request _method  $uri   '                 ' $status   $body _bytes_sent   '                ' $upstream _status   $upstream _addr  $request _time  '                 ' $upstream _response_time  $http _user_agent ';               2. Use logstash grok  to match the   log  filter {   if [type] ==  ' mobile-access '  {      #message   The matching pattern is easy to read split into multiple lines of writing, in the configuration file is actuallyA line of     grok {        match =>[             "message", '%{ipv4:remote_addr} -  (%{ username:user}|-)           \[%{httpdate:nginx_timestamp}\]%{ hostname:http_host}          %{word:request_method} %{ Uripath:uri}%{base10num:http_status}          %{base10num: Body_bytes_sent:int} (%{base10num:upstream_status}|-)             (?:%{hostport:upstream_addr}|-) (%{base16float:request_time}|-)             (%{base16float:upstream_response_time}|-) (

Logstash grok analysis Nginx access log

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.