- Newest
- Most votes
- Most comments
Yes, it is possible to filter CloudWatch logs based on user input using dashboard variables as you're attempting to do. However, there are a few things to check in your implementation:
- In your filter statement, you need to ensure you're referencing the variable correctly. Based on your JSON, you've defined a variable with ID "employee_id_input" but in your query, you're using it directly as "employee_id_input". You should reference it using the proper syntax for CloudWatch dashboard variables, which typically uses ${variable_id}.
Try modifying your filter statement to:
filter ofaEmployeeId = ${employee_id_input}
-
Make sure the field "ofaEmployeeId" is correctly extracted from your JSON logs. If your logs are properly formatted as JSON, CloudWatch should automatically parse these fields.
-
If you're planning to share this dashboard publicly, be aware that input variables won't work on publicly shared dashboards. When CloudWatch dashboards are shared publicly, they become view-only, and users cannot interact with dashboard variables. This is a limitation of the public sharing feature, which is designed for displaying information rather than interactive use.
If you need users without AWS credentials to interact with the dashboard variables, you might need to consider alternative approaches, such as creating a custom application that interacts with CloudWatch APIs.
Sources
How do you show input variables on publicly shared cloudwatch dashboard | AWS re:Post
answered a year ago
Relevant content
asked 4 years ago
asked 3 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 5 months ago

filter ofaEmployeeId = ${employee_id_input}
Token recognition error at: '' token recognition error at: '$' at line 2 and position 25