Filter log streams in aww cloudwatch

Is there a way to filter log streams using templates using the CloudWatch console?

For example, I have the following log streams in the Log Group - Log Group:

'/ var / prod / magazines'.

Log streams:

/ prod / [node_instance_id] / nginx_access
/ Prod / [node_instance_id] / nginx_error

I have a multi-node environment with auto scaling, etc. As such, the log streams can be quite confusing - here is an example of what I see in the log streams.

/ prod / 1a2b3c4d5e / nginx_access
 / Prod / 1a2b3c4d5e / nginx_error
 / Prod / 1b2b3c4d5e / nginx_access
 / Prod / 1b2b3c4d5e / nginx_error
 / Prod / 1c2b3c4d5e / nginx_access
 / Prod / 1c2b3c4d5e / nginx_error

I am trying to filter the log stream for all "nginx_access" only. But from the console, it looks like I can only specify the prefix. Is there anyway that I could filter the log streams using something like "* nginx_access"?

+3


source to share


1 answer


The DescribeLogStreams API only supports filtering with a prefix, and the console lists your log streams using this API. It is not possible to filter anything other than the prefix.

The best practice in your case would be to use 2 log groups, one for each type:



  • / var / prod / nginx_access
  • / var / prod / nginx_error

This way you can navigate to your logs by first selecting the appropriate log group and then looking for the instance id with a prefix filter.

+3


source







All Articles