分析日志

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!/bin/env python

import json
import time, datetime

stackP = open("./outLog")

for eachLine in stackP:
    result = eachLine.find("signalingDomain")
    if result == -1:
        continue
    stringStart = eachLine.find('{')
    stringEnd = eachLine.rfind('}')

    string = eachLine[stringStart:stringEnd + 1]

    jsonString = json.loads(string)
    sessionId = jsonString['commandHead']['sessionId']
    cCRequestType = jsonString['commandHead']['cCRequestType']
    cCRequestNumber = jsonString['commandHead']['cCRequestNumber']
    print sessionId, cCRequestType, cCRequestNumber