Dashboard Variables with Cloudwatch Insight Queries

I’m trying to add a new variable on a dashboard using a CloudWatch Insight query, but I think that Grafana dashboard variables don’t recognize log insight queries. I’m right?

My expected result is to use log insight queries to make dashboard variables results.

On “Variables” in my dashboard settings, I’m putting the info below.

On “General” section

Type: Query

On “Query options” section

Data source: My CloudWatch data source
Refresh: On dashboard load
Query:

fields @message
| filter @message like 'company_name'
| parse @message /\\"company_id\\":\\"(?<company_id>.*?)\\"/
| parse @message /\\"company_name\\": \\"(?<company_name>.*?)\\"/
| stats count(*) by company_id, company_name
| display company_id, company_name

Expected result: list a dropdown with companies ID and name.

Thanks for any help! :smiley:

I had the same question have you figured it out?