Python实现从log日志中提取ip的方法【正则提取】-创新互联

本文实例讲述了Python实现从log日志中提取ip的方法。分享给大家供大家参考,具体如下:

我们提供的服务有:网站设计制作、成都网站设计、微信公众号开发、网站优化、网站认证、宿迁ssl等。为近1000家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的宿迁网站制作公司

log日志内容如下(myjob.log):

124.90.53.68 - - [05/Feb/2018 11:37:07] "GET /favicon.ico HTTP/1.1" 404 -
61.148.245.145 - - [05/Feb/2018 12:37:44] "GET / HTTP/1.1" 200 -
61.148.245.145 - - [05/Feb/2018 12:37:44] "GET /apple-touch-icon-120x120-precomposed.png HTTP/1.1" 404 -
61.148.245.145 - - [05/Feb/2018 12:37:44] "GET /apple-touch-icon-120x120.png HTTP/1.1" 404 -
61.148.245.145 - - [05/Feb/2018 12:37:45] "GET /apple-touch-icon-precomposed.png HTTP/1.1" 404 -
61.148.245.145 - - [05/Feb/2018 12:37:45] "GET /apple-touch-icon.png HTTP/1.1" 404 -
61.148.245.145 - - [05/Feb/2018 12:37:45] "GET /static/favicon.ico HTTP/1.1" 200 -
101.226.33.218 - - [05/Feb/2018 13:07:39] "GET / HTTP/1.1" 200 -
101.226.33.219 - - [05/Feb/2018 13:09:46] "GET / HTTP/1.1" 200 -
101.226.33.219 - - [05/Feb/2018 13:09:46] "GET /static/youkulogo.png HTTP/1.1" 200 -
101.226.33.219 - - [05/Feb/2018 13:09:46] "GET /static/iqiyi.png HTTP/1.1" 200 -
101.226.33.219 - - [05/Feb/2018 13:09:46] "GET /static/qqlogo.png HTTP/1.1" 200 -
124.202.223.62 - - [05/Feb/2018 14:29:45] "GET / HTTP/1.1" 200 -
124.202.223.62 - - [05/Feb/2018 14:29:47] "GET /static/youkulogo.png HTTP/1.1" 200 -
124.202.223.62 - - [05/Feb/2018 14:29:48] "GET /static/qqlogo.png HTTP/1.1" 200 -
124.202.223.62 - - [05/Feb/2018 14:29:48] "GET /static/iqiyi.png HTTP/1.1" 200 -
124.202.223.62 - - [05/Feb/2018 14:29:49] "GET /static/favicon.ico HTTP/1.1" 200 -


分享文章:Python实现从log日志中提取ip的方法【正则提取】-创新互联
新闻来源:http://hxwzsj.com/article/diecsi.html

其他资讯

Copyright © 2025 青羊区翔捷宏鑫字牌设计制作工作室(个体工商户) All Rights Reserved 蜀ICP备2025123194号-14
友情链接: 企业网站设计 高端定制网站设计 网站建设开发 重庆外贸网站建设 成都网站设计 重庆手机网站建设 成都商城网站制作 成都网站制作 成都网站建设 成都网站建设公司 高端网站设计推广 响应式网站设计方案 企业网站建设公司 外贸网站建设 成都网站建设 重庆电商网站建设 响应式网站设计 网站制作 外贸网站设计方案 成都网站建设 营销型网站建设 成都网站设计