tencent cloud

Cloud Log Service

Release Notes and Announcements
Release Notes
Announcements
User Guide
Product Introduction
Overview
Features
Available Regions
Limits
Concepts
Service Regions and Service Providers
Purchase Guide
Billing Overview
Product Pricing
Pay-as-You-Go
Billing
Cleaning up CLS resources
Cost Optimization
FAQs
Getting Started
Getting Started in 1 Minute
Getting Started Guide
Quickly Trying out CLS with Demo
Operation Guide
Resource Management
Permission Management
Log Collection
Metric Collection
Log Storage
Metric Storage
Search and Analysis (Log Topic)
Search and Analysis (Metric Topic)
Dashboard
Data Processing documents
Shipping and Consumption
Monitoring Alarm
Cloud Insight
Independent DataSight console
Historical Documentation
Practical Tutorial
Log Collection
Search and Analysis
Dashboard
Monitoring Alarm
Shipping and Consumption
Cost Optimization
Developer Guide
Embedding CLS Console
CLS Connection to Grafana
API Documentation
History
Introduction
API Category
Making API Requests
Topic Management APIs
Log Set Management APIs
Index APIs
Topic Partition APIs
Machine Group APIs
Collection Configuration APIs
Log APIs
Metric APIs
Alarm Policy APIs
Data Processing APIs
Kafka Protocol Consumption APIs
CKafka Shipping Task APIs
Kafka Data Subscription APIs
COS Shipping Task APIs
SCF Delivery Task APIs
Scheduled SQL Analysis APIs
COS Data Import Task APIs
Data Types
Error Codes
FAQs
Health Check
Collection
Log Search
Others
CLS Service Level Agreement
CLS Policy
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary
DocumentationCloud Log ServicePractical TutorialMonitoring AlarmSetting Alarm Trigger Conditions by Time Period

Setting Alarm Trigger Conditions by Time Period

PDF
Focus Mode
Font Size
Last updated: 2024-01-20 17:28:40

Overview

For business nature reasons, different alarm trigger conditions need to be set for different time periods. For example, an alarm should be triggered when the number of logs containing errors exceeds 100 during work hours (9:00 AM to 6:00 PM) or when this number exceeds 10 during off hours (7:00 PM to 8:00 AM).

Configuration method

When configuring an alarm policy, enter the following query statements and trigger conditions:
Query statement 1:
error | select count(*) as error_count
Count logs containing errors
Query statement 2:
* | select hour(now()) as hour limit 1
Use date and time functions to get the alarm hour, i.e., at which hour the alarm is triggered.
Trigger conditions:
($1.error_count>100 && $2.hour>=9 && $2.hour<=18 ) || ($1.error_count>10 && ($2.hour<9 || $2.hour>18))
Use the trigger condition expression to specify a trigger condition and threshold. Here, $1.error_count>100 && $2.hour>=9 && $2.hour<=18 indicates to trigger an alarm when error_count exceeds 100 between 9:00 AM and 6:00 PM, while $1.error_count>10 && ($2.hour<9 || $2.hour>18) indicates to trigger an alarm when error_count exceeds 10 between 7:00 PM and 8:00 AM.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback