Simple Log Service (SLS) monitors your Knative Services for errors and sends alert notifications to your operations and development teams through DingTalk, SMS, or email when exceptions occur.
How it works
Alerting on Knative follows a three-stage pipeline:
-
Query — SLS runs a SQL query against your Logstore at a configured frequency to detect error patterns.
-
Evaluate — SLS checks whether the query results meet your alert trigger conditions.
-
Notify — When conditions are met, SLS routes notifications to your team through the channels defined in your notification policy.
Prerequisites
Before you begin, make sure you have:
-
A deployed Knative Service. See Quickly deploy a Knative service
-
Log collection enabled for the Knative Service. See Enable Simple Log Service on Knative
Step 1: Query and analyze logs
Build and verify the query that your alert rule will use to detect errors. For more about SLS query syntax, see Query and analyze logs.
-
Log on to the Simple Log Service console.
-
In the Projects section, click your project.

-
In the left-side navigation pane, click Log Storage. In the Logstores list, click your Logstore.

-
Enter a query in the search box and click Search & Analyze.
To monitor Services by error count, use the following SQL statement. It counts all log records that contain the error field and groups them by error type.
* | select 'ERROR' , count(1) as total group by 'ERROR'
Step 2: Configure an alert monitoring rule
Starting from the same Logstore query page in the SLS console:
-
Click the
icon on the query and analysis page.
-
In the Alert Monitoring Rules section, configure your alert rule.
Key parameters to set:
Parameter Description Example Check frequency How often SLS runs the query to evaluate conditions. Lower values give faster detection but increase query costs. Every 1 minute Trigger condition The threshold that causes the alert to fire. Fire when error count exceeds 0 For full configuration details, see Create log alert monitoring rules.
-
Set up a notification policy to define who receives alerts and through which channels (DingTalk, SMS, or email). For configuration steps, see Quickly set log alerts.
-
Verify the alert by sending a request to the
helloworld-goservice to trigger an error entry in the logs:curl -H "Host: helloworld-go.default.example.com" http://<Gateway IP>Replace
<Gateway IP>with your actual gateway IP address and update the domain name to match your setup.Expected response:
Hello Knative!After the check frequency interval passes, SLS evaluates the query results against your trigger condition. If the condition is met, you receive an alert notification through the channels configured in your notification policy.
What's next
Visualize Knative Service monitoring data on a Grafana dashboard in real time using Prometheus Service. See View Knative service monitoring dashboard.