Hi, All,
The company I work for have been trying to achieve the following:
Imagine we have 3 different AWS accounts to which we deploy the exact same CloudFormation stack. These represent Dev, Test, and Prod environments for the same application.
There’s a Lambda Function in the stack, which prints logs to a CloudWatch Log Group called /aws/lambda/EventEmitter. The same log group exists in the 3 accounts with the exact same name.
The company want to configure 3 CloudWatch datasources in Grafana, each pointing to a different account. The team then want to create a dashboard where the 3 possible datasources are presented in a drop down list, so that the user can choose which environment they want to look at.
Visualizations in the dashboard would be querying the logs in /aws/lambda/EventEmitter, but the query would have to be executed against a different datasource every time the user selects a different one from the drop down menu.
I could find a way to present the datasources as values the user can choose from, as a variable in the dashboard. However, it looks like visualizations that query CloudWatch Log Groups hold on to more details about the log groups than just their names. When I select a different value for the variable in the drop down, the query against the new account fails with an authorization error. I can see in the error message that it is still trying to access the Log Group from the data source that was previously selected.
Is there a way to achieve this in Grafana?
I essence, I’d need to be able to select a different datasource from the drop down menu and then automatically adjust any visualization in the dashboard to query the Log Group through the newly selected data source.