Variables in CloudWatch Logs not working in AWS Managed Grafana

It appears to me that it is not possible to use variables to dynamically create a query for CloudWatch:

Am I missing something or is this not a feature which is supported?


Hi @evgrusev

The use of template variables is supported in the Amazon CloudWatch plugin both for Grafana OSS and Grafana Cloud Grafana. It should also work for AWS Managed Grafana as it is the same plugin. You can read about how (and how not) to use these variables for the CloudWatch plugin here.

If you continue to experience issues and are an active Grafana Cloud user you may contact the Grafana Cloud Support team via your Cloud Portal/“My Account” on to further troubleshoot.

Hey @ximenaaliaguilla, thanks for the response.
The link which you sent is refering to the queries for the Metrics, my use case is concerned with the Logs Query Editor. Please refer to my screenshot - I have selected CloudWatch Logs and I need to use the variables within the query form.

Since you are using AWS Managed Grafana (and not Grafana Cloud) I would refer you to their knowledge base and support on this feature if the general Grafana documentation regarding that data source does not address it sufficiently. For example here: Using the CloudWatch data source - Amazon Managed Grafana where variables for logs query editor are mentioned.

That said, on the Grafana side I’m not aware of any known bugs related to variables with the CloudWatch logs query editor on the most recent version of Grafana (8.2.5), and can confirm that variables for logs in the CloudWatch plugin are supported there. If relevant, there was a bug on a recent version of Grafana but that has since been fixed: CloudWatch Logs: Can't use variables in query · Issue #24603 · grafana/grafana · GitHub

@ximenaaliaguilla Thank you, this helped me find the root cause.

The conclusion is that this is a bug that regressed on Grafana Version 8.2.2 and is fixed in 8.2.4. Unfortunatelly AWS Managed Grafana is still stuck at 8.2.2 so I had to provision an EC2 instance and manually deploy Grafana with the latest 8.2.4. After doing that the variables worked.