ELK企业应用-elk监控nginx(一)nginx格式配置

ELK企业应用-elk监控nginx(一)nginx格式配置

1、概述

Nignx日志主要有access和error两种日志,access中记录客户访问的所有记录,可根据需要并按照一定的格式配置不同参数以获取不同要的信息,以便于分析和统计。

nginx日志格式配置
建议配置如下:

log_format main '$remote_addr - $remote_user [$time_local] $http_host $request_method "$uri" "$query_string" '

                  '$status $body_bytes_sent "$http_referer" $upstream_status $upstream_addr $request_time $upstream_response_time '

                  '"$http_user_agent" "$http_x_forwarded_for"' ;

2、测试环境搭建

为了快速,全yum安装,配置文件全部默认

yum install nginx php php-fpm php-web -y

3、配置

3.1.配置主文件

vim /etc/nginx/nginx.conf

###########################################3

worker_processes  1;

events {

    worker_connections  1024;

}

http {

    include       mime.types;

    default_type  application/octet-stream;

    ############定义日志格式 log_format

    log_format  main  '$remote_addr - $remote_user [$time_local] $http_host $request_method "$uri" "$query_string" '

                      '$status $body_bytes_sent "$http_referer" $upstream_status $upstream_addr $request_time $upstream_response_time '

                      '"$http_user_agent" "$http_x_forwarded_f
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值