技术:python2.7
运行环境:python2.7 + windows 10
demo功能:提供一个python 处理mysql 慢查日志的代码dmeo
# coding:utf8
import os
import sys
import time
LOG_FILE = 'slow_query_3306.log'
def main():
counter = 0
res = []
with open(LOG_FILE, 'r') as lines:
for line in lines:
if counter > 0:
counter += 1
if line.find('# Time: ') >= 0:
counter = 1
if counter == 1:
res.append(line.split()[2]);
if counter == 2:
res.append(line.split()[2]);
if counter == 3:
res.append(line.split()[2]);
print len(res)
if __name__ == '__main__':
main()
欢迎添加微信,互相学习↑↑↑ -_-
白老虎
programming is not only to solve problems, ways to think
grafana 级连 菜单 templating (variables) 配置
AI 机器人 抓取 微信 聊天中的 百度网盘 分享地址和密码
rocketmq 集群搭建 (2master + 2slave + 2namesrv)