返回顶部

收藏

分析日志

更多
#!/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

标签:python

收藏

0人收藏

支持

0

反对

0

发表评论