Reputation: 33544
Consider log output:
2018-07-09 14:59:48,938 INFO [req-id:aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa] [sqs-m-id:aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa] [bucket:my-bucket] [s3Key:folder/myFile.pdf] com.mycompany.MyJavaClass - some message with spaces
2018-07-09 14:59:48,938 INFO [req-id:bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb] [sqs-m-id:bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb] [bucket:my-bucket] [s3Key:folder/myOtherFile.pdf] com.mycompany.MyJavaClass - some other message also with spaces
2018-07-09 14:59:48,938 INFO [req-id:bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb] [sqs-m-id:bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb] [bucket:my-bucket] [s3Key:folder/myOtherFile.pdf] com.mycompany.MyJavaClass - ELAPSED_TIME_NS 1520093301
START RequestId: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa Version: $LATEST
How to extract metric which will be applied to ELAPSED_TIME_NS
rows only. And grab value from it?
Upvotes: 0
Views: 581
Reputation: 12099
This pattern should work for you:
[..., message=ELAPSED_TIME_NS, nanoseconds]
Take a look here for more details: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html#extract-log-event-values
Upvotes: 1