- Newest
- Most votes
- Most comments
-
Create a CloudWatch Log Group: Ensure your camera logs are being sent to a CloudWatch Log Group.
-
Create Metric Filters: You'll need to create two metric filters for each camera:
- One to detect when a camera goes offline
- Another to detect when a camera comes back online
The filter pattern for offline events would look something like: [date, time, ..., cameraid="testc00013.test0001ev", ..., message="Device communication error"]
And for online events: [date, time, ..., cameraid="testc00013.test0001ev", ..., message="Device communication established"]
You'll need to create these filters for each unique camera ID.
-
Create Custom Metrics: When creating the metric filters, assign each a custom metric name. For example:
- CameraOffline_testc00013_test0001ev
- CameraOnline_testc00013_test0001ev
-
Create CloudWatch Alarms: For each camera, create an alarm that triggers if the camera is offline for more than 5 minutes. You can do this by:
- Using the "CameraOffline" metric as the alarm trigger
- Setting the threshold to 1 (indicating an offline event occurred)
- Setting the evaluation period to 5 minutes
- Using the "CameraOnline" metric to reset the alarm
-
Set up Notifications: Configure Amazon SNS (Simple Notification Service) to send notifications when alarms are triggered.
To implement this for hundreds of cameras, you may want to consider automating the process:
-
Use CloudWatch Logs Insights to query and identify all unique camera IDs in your logs.
-
Create a script or use AWS CloudFormation to automatically generate the necessary metric filters, custom metrics, and alarms for each camera ID.
-
Use AWS Lambda in combination with CloudWatch Events to dynamically create new alarms when new camera IDs are detected in the logs.
This approach allows you to create individual alarms for each camera, monitoring their offline status and alerting you if they don't come back online within 5 minutes. The automation suggestions can help manage this at scale for hundreds of cameras.
Sources
Alarming on logs - Amazon CloudWatch
Use CloudWatch alarms to monitor CloudTrail events | AWS re:Post
AWS announces CloudWatch Logs Anomaly Detection and Pattern analysis
Hello Andy, I saw your comment on the re:Post Agent post. Could you please share with me why the solution proposed does not work for you?
The log file could have potentially 1000's of cameraIDs in it and its unknown how many may go offline. So manually creating Metric filters for each is not feasible plus costly. I want to be able to automatically and dynamically create an alarm based on each unique camera ID. The Solution mentions using Lambda + cloud watch events but doesn't give any detail.
Relevant content
- asked 6 months ago
- asked a year ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 6 months ago
not really what I am after