Logsflags: g
CloudWatch Log Stream Path
Match AWS CloudWatch log group / stream paths like `/aws/lambda/my-function` or `/aws/ecs/cluster-name`.
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
\/aws\/(?:lambda|ecs|eks|apigateway|codebuild|stepfunctions|rds|cloudtrail)\/[\w\-.\/]+ (flags: g)Raw source: \/aws\/(?:lambda|ecs|eks|apigateway|codebuild|stepfunctions|rds|cloudtrail)\/[\w\-.\/]+
How it works
Anchors on the AWS-managed log group prefix `/aws/`, then a known service name from the alternation, then the resource path. The character class [\w\-.\/] allows word chars, hyphens, dots, and slashes — covering nested paths like `/aws/lambda/prod-handler/2024/01/15`.
Examples
Input
Group: /aws/lambda/api-gateway-handlerMatches
/aws/lambda/api-gateway-handler
Input
/aws/ecs/my-cluster/web-serviceMatches
/aws/ecs/my-cluster/web-service
Input
/myapp/custom/logsNo match
—Common use cases
- •Log shipper / forwarder configuration validation
- •Cost-allocation tooling that buckets by service
- •Alert routing based on log group origin
- •Migrating CloudWatch logs to other backends
Related patterns
Log Level
LogsMatches standard log level keywords in log lines.
Apache Common Log Format
LogsParses Apache Common Log Format entries.
JSON Log Line (Single-Line Object)
LogsMatch a single-line JSON object — typical of structured logging from services like slog, Bunyan, or Pino.
Nginx Error Log
LogsParses Nginx error log lines.