Logstash patterns, log analysis (i)

Source: Internet
Author: User
Tags apache log logstash

Grok-patterns contains log parsing rules for regular expressions with many underlying variables, including Apache log parsing (which can also be used for nginx log parsing).   Based on Nginx log analysis configuration: 1. Configure the Nginx log format as follows: Log_format main ' $remote _addr [$time _local] "$request" $status $body _bytes_ Sent "" $http _referer "" "$request _time" ';  access_log/var/log/nginx/access.log main; The Nginx log is screened, Remove unused logs. At this time, for the log format of the Convention to be more careful, I in the debugging process, in the Nginx log more than a few spaces, logstash half-day resolution. The 2.logstash log format is configured as follows: input {file {path ' = '/var/log/nginx/*.log '}}filter {if [path] =~ "Access" {mutate {replace + = { "Type" = "nginx_access"}}grok {match + = {"Message" = "%{iporhost:clientip} \[%{httpdate:timestamp}\] \" (?:% {Word:method}%{notspace:request} (?: Http/%{number:httpversion})? | %{data:rawrequest}) \ "%{number:response} (?:%{number:bytes}|-)%{qs:referrer}%{qs:timeconsumer}"}}}date {match = > ["Timestamp", "Dd/mmm/yyyy:hh:mm:ss Z"]}}output {redis {data_type + = "List" key = "Logstash"}} so the Nginx log Request URL, request method, request time-consuming, Response bytes, request times basically separated out, follow-up with Kibana can do data market monitoring and analysis.   while trying to logstash the business log,For the Business log format, you need to define a set of parsing rules, follow-up to improve related processing expressions.

Logstash patterns, log analysis (i)

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.