0
votes

In AWS Cloudwatch, I would like to extract a value from my log data. however the value is in the message field. Is there anyway I can grab the last space delimited value and log that?

i.e. my log stream:

{"timestamp": 145674445, "message": "Starting new HTTP connection (1): XXXX", "severity": "INFO", "module": "connectionpool", "stack": []}
{"timestamp": 145676445, "message": "Starting new HTTP connection (1): XXXX", "severity": "INFO", "module": "connectionpool", "stack": []}
{"timestamp": 145676445, "message": "deactivated campaign: XXXX05XXXX554aaXXXX9069d4XXXXe7, runtime: 2.63", "severity": "INFO", "module": "credentials", "stack": []}

for the last log, i would like to filter pattern on something like

{($.message ="deactivated campaign:*, runtime: *")}

and I would like to be able to have the metric value I record be 2.63, or the last space delimited string.

I am using the GUI for this, and cannot figure out a way to do it. is it possible?

Any help in advance is greatly appreciated!

1

1 Answers

0
votes

Look at http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/FilterAndPatternSyntax.html

Something like this (haven't tested it, but something along these lines):

metricFilter: { $.message = "deactivated campaign:*" } metricValue: $.runtime