使用log_format为Nginx服务器设置更详细的日志格式
来源:互联网 发布:淘宝招聘客服 编辑:程序博客网 时间:2024/06/06 22:45
nginx服务器日志相关指令主要有两条,一条是log_format,用来设置日志格式,另外一条是access_log,用来指定日志文件的存放路径、格式和缓存大小,一般在nginx的配置文件中日记配置(/usr/local/nginx/conf/nginx.conf)。
nginx的log_format有很多可选的参数用于指示服务器的活动状态,默认的是:
log_format access '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';
想要记录更详细的信息需要自己设置log_format,具体可设置的参数格式及说明如下:
#vim /usr/local/nginx/conf/nginx.conflog_format access //这边定义日志的名称为access,依据不同业务定义不同日志名称引用'$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" $http_x_forwarded_for ''"$upstream_addr" "$upstream_status" "$upstream_response_time" "$request_time"'; include /usr/local/nginx/conf/vhost/*.conf;
#vim /usr/local/nginx/conf/vhost/web.conf server { listen 80 default; server_name www.it300.com; index index.html index.htm index.php; root /data/httpd/it300.com; location ~ .*\.php?$ { include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 1h; } access_log /data/logs/it300.com.log access; //引用日志access格式 }
0 0
- 使用log_format为Nginx服务器设置更详细的日志格式
- 使用log_format为Nginx服务器设置更详细的日志格式
- Nginx服务器log_format设置更详细的日志格式
- Nginx 用log_format设置日志格式
- Nginx 用log_format设置日志格式
- Nginx日志格式设置
- Nginx日志格式设置
- nginx - log_format
- Nginx warn] the "log_format"
- nginx log_format for webalizer
- nginx log_format详解
- nginx日志格式的设计
- 根据需要为不同的类设置不同的输出日志名称及日志格式
- Nginx配置文件简单说明log_format
- nginx log_format 变量含义详解
- 为PHP设置服务器(Apache/Nginx)环境变量
- 为PHP设置服务器(Apache/Nginx)环境变量
- 使用nginx配置拉去服务器日志
- aaaa555555555
- 自定义View--圆形ImageView
- 怎么解决input框中加入disabled="disabled"之后,改变字体的颜色(默认的是灰色)
- Socket网络编程中的函数详解
- html5标签figure、figcaption
- 使用log_format为Nginx服务器设置更详细的日志格式
- Volatile关键字的使用
- 基于Kafka 0.9版本 使用ACL进行权限控制
- Oracle之唯一性约束(UNIQUEConstraint)用法详解
- android IOS java使用DES统一加密策略
- .net 的SSH操作linux文件
- Java学习之继承
- SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.driver.Oracle ’
- CAS硬件指令