Nginx 的日志都是写在一个文件当中的,不会自动地进行切割,如果访问量很大的话,将导致日志文件容量非常大,不便于管理和造成Nginx 日志写入效率低下等问题。所以,往往需要要对access_log、error_log日志进行切割。 切割日志一般利用USR1信号让nginx产生新的日志。实例: 1、 ...
分类:
其他好文 时间:
2017-12-01 23:32:22
阅读次数:
184
server{
listen80;
server_namewww.idc.dev;
access_log/data/wwwlogs/www.idc.dev_nginx.logcombined;
indexindex.htmlindex.htmindex.php;
root/mnt/hgfs/woker_project/www.idc.dev/wwwroot;
location/{
try_files$uri@apache;
#跨域设置
add_headerAccess-Control-Allow-..
分类:
其他好文 时间:
2017-11-22 17:51:15
阅读次数:
221
nginx启动和关闭(centos平台) http 模块 http模块可以说是最核心的模块了,它负责HTTP服务器相关属性的配置,它里面的server和upstream子模块 log_format 用于设置日志的格式,和记录哪些参数,这里设置为main access_log 用来纪录每次的访问日志的 ...
分类:
其他好文 时间:
2017-11-21 22:01:31
阅读次数:
128
统计查看文件以及筛选日志 1、*.log 日志文件中 统计独立ip的个数: awk '{print $1}' test.log | sort | uniq | wc -l 2、#查询访问最多的前10个ip awk '{print $1}' /access.log | sort | uniq -c | ...
分类:
系统相关 时间:
2017-11-17 23:33:07
阅读次数:
376
1、 nginx日志统计独立ip的个数: awk '{print $1}' /access.log | sort | uniq | wc -l 2、 查询访问最多的前10个ip awk '{print $1}' /access.log | sort | uniq -c | sort -nr | he... ...
分类:
其他好文 时间:
2017-11-17 16:14:01
阅读次数:
107
[root@Cobbler logs]# awk 'BEGIN{print "IP地址","访问流量","访问次数"}{a[$1]++;b[$1]+=$10}END{for (i in a) print i,a[i],b[i]|"sort -rnk3"}' access_log IP地址 访问流量 ...
分类:
其他好文 时间:
2017-11-16 17:18:00
阅读次数:
137
cat -n access.log -n打印行号 more access.log 空格-下一页、回车-下一行、F-下一屏,百分比的下一个、B-上一屏 less access.log /查找 tail -n2 access.log -n2显示最后2行 -f监控最后追加的内容 head -n2 acce... ...
分类:
其他好文 时间:
2017-11-15 22:04:44
阅读次数:
199
目的介绍:用python脚本对nginx的access_log日志分析,获取到每个IP的访问次数,将IP和访问次数构建一个字典,最后对字典排序输入。#!/usr/bin/envpython
#-*-coding:utf8-*-
"""
分析Nginx等Web应用访问IP信息并将其访问数量从大到小排序
"""
ip_list=[]#定义空列表所有的访问..
分类:
编程语言 时间:
2017-11-15 21:42:43
阅读次数:
1596
#监控location /status { stub_status on; access_log off;} #代理 location / { proxy_pass http://10.1.2.170:8081/; proxy_set_header Host $host; proxy_set_hea ...
分类:
其他好文 时间:
2017-11-13 16:48:25
阅读次数:
227
[16]SQL INNER JOIN 关键字 INNER JOIN 关键字在表中存在至少一个匹配时返回行。 SQL INNER JOIN 语法 或: 注释:INNER JOIN 与 JOIN 是相同的。 下面是选自 "Websites" 表的数据: 下面是 "access_log" 网站访问记录表的 ...
分类:
数据库 时间:
2017-11-11 21:28:42
阅读次数:
239