1 Answer
- Newest
- Most votes
- Most comments
1
Hello.
I also tried using the code below, but I couldn't switch the display using the dashboard variable.
Probably, but I was wondering if the log query widget can't be toggled with a dashboard variable.
const variables = new cw.DashboardVariable({
id: "functionName",
type: cw.VariableType.PROPERTY,
label: "Function",
inputType: cw.VariableInputType.SELECT,
value: "FunctionName",
values: cw.Values.fromSearchComponents({
namespace: "AWS/Lambda",
dimensions: ["FunctionName"],
metricName: "Duration",
populateFrom: "FunctionName",
}),
defaultValue: cw.DefaultValue.FIRST,
visible: true,
});
const dashboard = new Dashboard(this, "SampleLambdaDashboard", {
dashboardName: "myLambdaDashboard",
variables: [variables],
});
dashboard.addWidgets(
new TextWidget({
markdown: `# Dashboard: ${lambdaFunction.functionName}`,
height: 1,
width: 24,
})
);
dashboard.addWidgets(
new LogQueryWidget({
logGroupNames: [lambdaFunction.logGroup.logGroupName],
queryLines: [
"fields @timestamp, @message",
"sort @timestamp desc",
"limit 20",
],
width: 24,
})
);
}
}
Relevant content
- asked 8 months ago
- Accepted Answerasked 10 months ago
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated a year ago