V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
t895
V2EX  ›  Python

有什么可以统计日志信息的脚本?最好是用 Python 写的,开源的最好!

  •  
  •   t895 · 2015-11-25 00:26:07 +08:00 · 1807 次点击
    这是一个创建于 3085 天前的主题,其中的信息可能已经有所发展或是发生改变。
    2015-11-24 22:21:15 ERROR [Errno 104] Connection reset by peer
    2015-11-24 22:21:16 INFO TCP connecting 2.20.254.219:443 from ::ffff:113.79.243.5:54150
    2015-11-24 22:21:16 WARNING timed out: 216.58.192.206:443
    2015-11-24 22:21:16 WARNING timed out: 74.125.203.101:443
    2015-11-24 22:21:17 INFO TCP connecting 92.123.155.57:443 from ::ffff:27.44.218.91:59766
    2015-11-24 22:21:17 INFO TCP connecting 74.6.166.159:80 from ::ffff:27.44.218.91:59772
    2015-11-24 22:21:18 ERROR [Errno 104] Connection reset by peer

    这是我的日志,我像用 Python 统计里面的 Errno 和 WARNING 其他的都可以不需要!
    统计 Errno 的上一行内容 TCP connecting 74.6.166.159:80 from ::ffff:27.44.218.91:59772
    取值 74.6.166.159:80 这个 IP 和 ffff:27.44.218.91:59772 之后的 IP
    统计 WARNING 的所有信息!
    有类似开源的吗??
    t895
        1
    t895  
    OP
       2015-11-25 00:27:34 +08:00
    对了,这个日志是实时的!
    ri0day
        2
    ri0day  
       2015-11-25 11:23:23 +08:00
    logstash
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3471 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 11:11 · PVG 19:11 · LAX 04:11 · JFK 07:11
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.