nginx日志管理
来源:互联网 发布:天津平山道淘宝城 编辑:程序博客网 时间:2024/04/27 22:44
#access_log logs/host.access.log main;
这说明 该server, 它的访问日志的文件是 logs/host.access.log ,
使用的格式”main”格式.
除了main格式,可以自定义其他格式.
main格式是什么?
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
main格式是定义好一种日志的格式,并起个名字,便于引用.
以上面的例子, main类型的日志,记录的 remote_addr.... http_x_forwarded_for等选项.
1: 日志格式 是指记录哪些选项
默认的日志格式: main
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
如默认的main日志格式,记录这么几项
远程IP- 远程用户/用户时间 请求方法(如GET/POST) 请求体body长度 referer来源信息
http-user-agent用户代理/蜘蛛 ,被转发的请求的原始IP
http_x_forwarded_for:在经过代理时,代理把你的本来IP加在此头信息中,传输你的原始IP
2: 声明一个独特的log_format并命名
log_format mylog '$remote_addr- "$request" '
'$status $body_bytes_sent "$http_referer" '
在server段中,这样来声明
Nginx允许针对不同的server做不同的Log ,(有的web服务器不支持,如lighttp)
access_log logs/access_8080.log mylog;
这说明 该server, 它的访问日志的文件是 logs/host.access.log ,
使用的格式”main”格式.
除了main格式,可以自定义其他格式.
main格式是什么?
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
main格式是定义好一种日志的格式,并起个名字,便于引用.
以上面的例子, main类型的日志,记录的 remote_addr.... http_x_forwarded_for等选项.
1: 日志格式 是指记录哪些选项
默认的日志格式: main
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
如默认的main日志格式,记录这么几项
远程IP- 远程用户/用户时间 请求方法(如GET/POST) 请求体body长度 referer来源信息
http-user-agent用户代理/蜘蛛 ,被转发的请求的原始IP
http_x_forwarded_for:在经过代理时,代理把你的本来IP加在此头信息中,传输你的原始IP
2: 声明一个独特的log_format并命名
log_format mylog '$remote_addr- "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
在server段中,这样来声明
Nginx允许针对不同的server做不同的Log ,(有的web服务器不支持,如lighttp)
access_log logs/access_8080.log mylog;
声明log log位置 log格式;
0 0
- nginx日志管理
- nginx---日志管理
- nginx日志管理
- Nginx访问日志管理
- nginx日志管理
- nginx日志管理
- nginx 日志管理
- nginx 日志管理
- Nginx的日志管理
- 9.Nginx 日志管理
- Nginx之日志管理
- nginx日志管理
- Nginx教程(三) Nginx日志管理
- linux:使用logrotate管理nginx日志文件
- logrotate管理分割nginx日志无效
- Nginx切割日志管理简单说明
- NGINX 日志文件切割及管理
- 使用logrotate管理nginx日志文件
- 黑马程序员---Objective-C 内存管理 - set方法的内存管理
- LeetCode Count Primes
- Java时间格式转换大全
- linux shell
- DuiVision开发教程(9)-动态创建控件
- nginx日志管理
- mac下git与github简单使用
- 安卓创建接收短信发送短信
- p124 第三章 第45题 潘璠(未用递推)
- cocos2dx3.x的所有事件总结
- Carcassonne - HDU 4064 状压dp
- HOJ 1014 Niven Numbers
- PHP不同版本PDO设置字符集
- 关于 位运算