使用rex提取字段

source="c:\logs\abc.log" 
| rex field=url "(?<=\/)(?<ApiId>\w+?)(?=$|\?)"
| search url != "*/swagger/"
| spath output=timeSpent path=durationInMs
| spath output=status path=data.statusCode
| evel error = if(status != 200, 1, 0)
| stats count as total, avg(timeSpent) as avgTimeSpent, sum(error) as errCount by ApiId
| eval errorRate = round(100 * errCount / total, 2), avgTimeSpent= round(avgSpentTime, 2)
| sort total desc

rex匹配出JSON数据,使用spath提取字段

sourcetype=webapi_service
| rex "^(?:[^\{]*)(?P<data>.+)"
|spath input=data output=statusCode path=responseHeader.statsuCode
|spath input=data output=responseId path=responseHeader.responseId
|table responseId, statusCode

相关文章:

  • 2021-11-19
  • 2021-05-19
  • 2021-10-20
  • 2021-07-18
  • 2021-10-28
  • 2021-08-22
  • 2021-11-01
  • 2021-11-14
猜你喜欢
  • 2021-08-07
  • 2021-08-11
  • 2021-09-06
  • 2021-10-10
  • 2021-06-18
相关资源
相似解决方案