I am working with data that comes in similar format to this in insights. Sometimes the value of J may be missing and I want to set the value as the value of B if this is the case. Is there any way to do conditional logic similar to this on data in CloudWatch Insights? I have explored ispresent() but cannot figure out how to do the conditional logic.
Example:
| B | J |
|---|---|
| 1 | 3 |
| 2 | 4 |
| 2 |
for the last I would like to set the data equal in J to 2 when I run the query.
You may be able to use coalesce(J, B) which won't set the J to 2 but can be assigned to a new field (e.g. fields coalesce(J, B) as newB that can be used for display or additional logic. coalesce takes 2+ arguments and returns the first value that isn't blank.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html (search for coalesce)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With