Alibaba Cloud Ingress logs HTTP requests to stdout. Enable log collection when you create a cluster, then use Simple Log Service (SLS) to view Nginx Ingress access-log analytics and monitor real-time Ingress status. This topic describes how to deploy and view Nginx Ingress access logs.
Prerequisites
Before you begin, ensure that you have:
loongcollector is installed in your cluster (default during cluster creation). If missing, see Collect text logs from Kubernetes containers in DaemonSet mode.
alibaba-log-controller is updated:
kubectl edit deployment alibaba-log-controller -n kube-system
Enable log collection for nginx-ingress-controller
Use the ACK console unless you need to automate setup through a GitOps or CI/CD pipeline.
ACK console
Log on to the ACK console. In the left-side navigation pane, click ACK consoleClusters.
On the Clusters page, click the target cluster. In the left-side navigation pane, choose Operations > Add-ons.
On the Add-ons page, click the Networking tab. On the Nginx Ingress Controller card, click the
icon and select Enable Log Collection. Click OK.
CLI
ACK provides a CRD named AliyunLogConfig. When you create an AliyunLogConfig, alibaba-log-controller automatically generates the SLS configuration and updates the dashboards.
Before creating an AliyunLogConfig:
If nginx-ingress-controller pods already exist, recreate them after applying the
AliyunLogConfigfor log collection to take effect.alibaba-log-controller must be version
0.2.0.0-76648ee-aliyunor later. If anAliyunLogConfigalready exists after updating the controller, delete and recreate it.This configuration assumes the default ACK log format. If you customized the log format, update the
processor_regexsection. See Use CRDs to collect container logs in DaemonSet mode.
Create a file named
k8s-nginx-ingress.yamlwith the following content:Set
IncludeLabelto Docker labels fromdocker inspect.io.kubernetes.pod.namespaceselects by namespace;io.kubernetes.container.nameselects by container. For example,io.kubernetes.pod.namespace: backend-prodcollects all containers in that namespace;io.kubernetes.container.name: worker-servertargets a specific container. Specify only these two labels. To filter by environment variables, useIncludeEnvorExcludeEnv. See Use the Simple Log Service console to collect container stdout and stderr in DaemonSet mode.Field
Description
Modify?
metadata.namespaceNamespace of the Ingress controller
Yes, if not
kube-systemspec.logstoreSLS Logstore name
Optional
IncludeLabelDocker labels used to select containers
Yes, if collecting from a specific namespace
processor_regex>RegexLog parsing regex
Only if you changed the default log format
apiVersion: log.alibabacloud.com/v1alpha1 kind: AliyunLogConfig metadata: # Unique name for this AliyunLogConfig within the cluster. name: k8s-nginx-ingress # Set to the namespace of the Ingress controller you want to collect logs from. namespace: kube-system spec: # The SLS Logstore where logs are stored. logstore: nginx-ingress # Product code — do not change this value. productCode: k8s-nginx-ingress logtailConfig: inputType: plugin # Must match metadata.name. configName: k8s-nginx-ingress inputDetail: plugin: inputs: - type: service_docker_stdout detail: IncludeLabel: # Collect logs from the nginx-ingress-controller container. # If multiple Ingress controllers run in your cluster, collecting # by container name may produce duplicate logs. Review the # IncludeLabel behavior before applying. io.kubernetes.container.name: nginx-ingress-controller Stderr: true Stdout: true processors: - type: processor_regex detail: KeepSource: false # Fields extracted from each log line, in order: Keys: - client_ip - x_forward_for - remote_user - time - method - url - version - status - body_bytes_sent - http_referer - http_user_agent - request_length - request_time - proxy_upstream_name - upstream_addr - upstream_response_length - upstream_response_time - upstream_status - req_id - host - proxy_alternative_upstream_name NoKeyError: true NoMatchError: true # Regular expression that maps each capture group to the Keys above. Regex: ^(\S+)\s-\s\[([^]]+)]\s-\s(\S+)\s\[(\S+)\s\S+\s"(\w+)\s(\S+)\s([^"]+)"\s(\d+)\s(\d+)\s"([^"]*)"\s"([^"]*)"\s(\S+)\s(\S+)+\s\[([^]]*)]\s(\S+?(?:,\s\S+?)*)\s(\S+?(?:,\s\S+?)*)\s(\S+?(?:,\s\S+?)*)\s(\S+?(?:,\s\S+?)*)\s(\S+)\s*(\S*)\s*\[*([^]]*)\]*.* SourceKey: contentThe following table describes the fields you are most likely to customize:
Apply the configuration:
kubectl apply -f k8s-nginx-ingress.yaml
To disable log collection, delete the AliyunLogConfig:
kubectl delete aliyunlogconfig k8s-nginx-ingress -n kube-systemView the access log and dashboards
Log on to the Simple Log Service console.
In the Projects section, click the project for your ACK cluster (named
k8s-log-{cluster-id}).In the left-side navigation pane, click the
icon, then select a dashboard from the list.
Available dashboards:
Dashboard | Time range | What it shows |
Ingress overview | Last 24 h / last 1 min | Traffic volume, latency, error rates, geographic distribution, top URLs |
Ingress access center | Last 24 h | UV/PV counts, regional distribution, top browsers and source IPs, mobile breakdown |
Ingress monitoring center | Last 1 h | Real-time success rate, error proportions, latency percentiles, top Services by PV and failure rate |
Ingress monitoring center for blue-green deployments | Dynamic | Side-by-side comparison of ServiceA and ServiceB metrics for safe rollouts |
Ingress exceptions center | Automatic | Anomaly detection powered by SLS machine learning and time series analysis |
Ingress overview
Tracks website-level traffic through nginx-ingress-controller. Key metrics:
Last 24 hours: page views (PVs), unique visitors (UVs), inbound/outbound traffic, average latency, mobile user proportion, 5xx error proportion, 404 error proportion
Last 1 minute: PVs, UVs, request success rate, average latency, P95 latency, P99 latency
Trends and distribution: PV trend over 24 hours and 7 days, regional request distribution, top areas and cities, Android/iOS breakdown
Top URLs (last 1 hour): 10 URLs by highest PVs, highest latency, most 5xx errors, and most 404 errors
Ingress access center
Request origins and client distribution over 24 hours: UV/PV counts, regional breakdown, top browsers, source IPs, and mobile proportions.
Ingress monitoring center
Real-time metrics from the last hour for detecting and triaging issues:
Request success rate, 5xx proportion, 404 proportion, and proportion of requests not forwarded upstream
Average latency, P95 latency, P99 latency, and P999 latency
Request distribution by status code, and PV proportion per Ingress
Top 10 Services by PVs, failure rate, average latency, and total requests

Ingress monitoring center for blue-green deployments
Side-by-side comparison of ServiceA and ServiceB metrics — PVs, error rates, latency percentiles, and total requests — to detect regressions during blue-green rollouts.

Ingress exceptions center
Detects anomalies in nginx-ingress-controller logs using SLS machine learning and time series analysis.

Configure alerts
Configure alert rules on any dashboard chart, with notifications via email, DingTalk chatbot, webhooks, or SMS.
This example creates an alert that fires when the 5xx error proportion exceeds 1%, checked every 5 minutes.
In the Dashboard section, click Ingress Monitoring Center. Hover over the
icon in the upper-right corner of the 5XX Proportion chart and click Save as Alert (Old Version).
In the Create Alert wizard, set Alert Name, Associated Chart, Frequency, and Trigger Condition. The
totalfield represents the 5xx error proportion; set Trigger Condition tototal > 1.On the Notifications page, select notification channels, configure parameters, and click Submit.
Subscribe to a dashboard
Deliver scheduled dashboard snapshots to an email address or DingTalk group. See Subscribe to a dashboard.
This example subscribes to the Ingress Overview V1.2 dashboard and sends a daily snapshot to a DingTalk group at 10:00.
In the Dashboard section, click Ingress Overview V1.2. Choose Subscribe > Create.
In the Create Subscription wizard, set Frequency to Daily and 10:00. Turn off Add Watermark, then click Next.
On the Notifications page, select WebHook-DingTalk Bot from Notifications and set Request URL to your DingTalk chatbot webhook URL. Click Submit.
Use the Ingress dashboard with ARMS
The Ingress Overview V1.2 dashboard integrates with Application Real-Time Monitoring Service (ARMS) to provide end-to-end trace visibility.
Log on to the Simple Log Service console.
In the Projects section, click the project for your ACK cluster.
In the left-side navigation pane, click the
icon and select Ingress Overview V1.2 from the Dashboard list.In the Top 10 Request URLs by Latency section, click a URL in the URL(ARMS Troubleshooting) column to view ARMS trace details for that Service.
Next steps
Data filtering plugin — apply log query filters to drill into specific requests or time windows.