简单查日志命令

VI标准 linux编辑器http://www.newsmth.net/pc/pccon.php?id=5721&nid=220783

VI编辑器基本操作

i :切换到输入模式

删除:backspace delete 键

退出 插入模式 是 esc 键

在 查看模式下 双击d 键 是 删除一行

查看模式下 按 o 在当前行下面新增 一行 并且 进入 插入模式

回到 行头 home 键      行尾 end 键

向上翻页 Ctrl + u    向下翻页 Ctrl + d    翻页的操作 都是在 查看模式下

 访问日志vi /etc/httpd/logs/access_log

防火墙规则 /etc/sysconfig/iptables

tail -f /etc/httpd/logs/access_log

访问的就是 access

错误的就是error
错误的是 vi /etc/httpd/logs/error_log

 Ctrl + D 下翻页

Ctrl + U 上翻页

退出时 esc + :q! 【强制不保存退出】

退出时 esc+     :wq!【强制并且保存退出】

tail -f /etc/httpd/logs/access_log |grep

---------------------------------------------------------

实时监控访问日志命令tail -f access_log   tail -n 50 -f example.txt

-------------------

日志筛选命令 tail -f ~/access_log |grep XX        (参数=特征)   筛选有特征的命令

-----------------

输出有访问特征mumber的IP tail -f ~/access_log |grep member|awk '{print $1}'        

--------------------

例子:打印出来包含此特征的所有第一列IP保存到CC1文件里

tail -f access_log|grep "311 '-' '-'"|awk '{print $1}' > cc1

第一列是 IP 所以 用 print $1

------------------

 

log-no-refer-agent-ip > c  cc-ip-paser c       service iptables restart    blockthis 116.253.107.86


www.88s5.com

www.jisuying.com

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值