FilterPattern of FilterLogEvents does not pick the string explicitly

帅比萌擦擦* 提交于 2019-12-13 07:02:30

问题


With this code, and using the FilterLogEvents function I am getting the logs from Cloudwatch that match these parameters:

{
    "endTime": number,
    "filterPattern": "string",
    "interleaved": boolean,
    "limit": number,
    "logGroupName": "string",
    "logStreamNames": [ "string" ],
    "nextToken": "string",
    "startTime": number
}

The code:

response = self.cloudWatchLogs.filter_log_events(**kwargs)

I defined filterPattern to be "ERROR" so that I can get all the error logs. My problem is that I get also other logs with the string : INTERRORESEAU. I set the filterPattern to ".ERROR:" but I still get the fake errors. How to tell the filterpattern to pick only and explicitly ERROR ?


回答1:


Your filter pattern should be :

 kwargs['filterPattern']='".ERROR:"' 

Like that you make sure you are picking the exact error word.



来源:https://stackoverflow.com/questions/41635843/filterpattern-of-filterlogevents-does-not-pick-the-string-explicitly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!