View egress audit logs
Egress audit logs record the network destinations that a sandbox attempts to access, and whether egress policies allow or deny each access. The logs are delivered to Simple Log Service (SLS).
Overview and scope
Egress Access Control restricts the destinations that a sandbox can access, and network audit tells you how these restrictions are enforced at runtime.
-
Configure an SLS project and Logstore in the same region as the sandbox. To configure them through a template, see Runtime log configuration. Check that log delivery and instance-level metrics (enableInstanceMetrics) are enabled, and that the project and Logstore are valid.
-
Configure egress access control for the sandbox with rules such as
allowOut,denyOut, orallowInternetAccess: false. This audit takes effect only when egress access control is configured. If only credential injection rules are configured, this audit is not enabled.
Log fields
Common fields
|
Field |
Description |
Example |
|
|
Log type. Fixed value: |
|
|
|
The ID of the sandbox that generated the record. Use it to correlate records with your tasks. |
|
|
|
The log time reserved by SLS. It is the time when the audit event occurred, accurate to the second. The log body has no separate time field. |
Shown in the SLS time column |
|
|
The log topic reserved by SLS. |
|
Network access and DNS query fields
|
Field |
Description |
Example |
|
|
The observed protocol. Valid values: |
|
|
|
The HTTP Host, the Transport Layer Security (TLS) Server Name Indication (SNI), the DNS query domain, or the destination IP. If the HTTP Host or TLS SNI cannot be obtained, the destination IP is used. Records such as plain Transmission Control Protocol (TCP) or User Datagram Protocol (UDP) access use the destination IP. |
|
|
|
The destination IP observed at the policy decision point during network access. DNS query records do not contain this field. |
|
|
|
The destination port of HTTP, HTTPS, TCP, and UDP network access. DNS, Internet Control Message Protocol (ICMP), and other protocol records do not contain this field. |
|
|
|
The policy result. |
|
|
|
Included only in DNS records. Indicates the query type. |
|
|
|
Included only in DNS records. Indicates the transport protocol used by the query. |
|
Audit throttling notification fields
When audit records are generated too quickly, you may receive an eventType: auditThrottled notification. It indicates that some audit records were not retained because of throttling. It contains the common fields and the fields in the following table, but not access result fields such as action, protocol, or destination. When you analyze access trends or investigate security events, check these notifications as well so that incomplete records are not treated as the full set of access records.
|
Field |
Description |
Example |
|
|
Event type. Fixed value: |
|
|
|
The throttling reason. Fixed value: |
|
|
|
The number of audit records that were not retained during the throttling period covered by this notification. This is not the number of dropped network packets. |
|
|
|
The admission limit of a single audit collection process for this instance, in records per second. This is not the combined limit for all audit records of the sandbox. The actual value in the log is authoritative. |
|
|
|
The time of the first record that was not retained during the throttling period, in Coordinated Universal Time (UTC). |
|
|
|
The time of the last record that was not retained during the throttling period, in UTC. |
|
Log examples
The following JSON shows the main fields in the SLS log body, excluding the common function context and the fields reserved by SLS. The domain names, IP addresses, and sandbox ID are sample values.
HTTPS access allowed
{
"logType": "networkAudit",
"sandboxID": "sbx-example",
"protocol": "https",
"destination": "api.example.com",
"destinationIP": "203.0.113.10",
"destinationPort": "443",
"action": "allow"
}
This record indicates that the egress policy allowed the sandbox to access the destination. If the task still fails, continue to check TLS, service authentication, and application responses.
HTTP access denied
{
"logType": "networkAudit",
"sandboxID": "sbx-example",
"protocol": "http",
"destination": "blocked.example.com",
"destinationIP": "198.51.100.20",
"destinationPort": "80",
"action": "deny"
}
This record indicates that the HTTP request from the sandbox to blocked.example.com was denied by the egress policy.
TCP access denied
{
"logType": "networkAudit",
"sandboxID": "sbx-example",
"protocol": "tcp",
"destination": "198.51.100.20",
"destinationIP": "198.51.100.20",
"destinationPort": "5432",
"action": "deny"
}
This record indicates that the egress policy denied the sandbox when it accessed port 5432 of the IP address. Compare the record with the expected behavior of your task to determine whether database access was missing from the configuration, or an unexpected outbound connection was attempted.
Query audit records in SLS
Open the SLS project and Logstore that actually take effect for the target sandbox. If you specified the log configuration by using the fc.sandbox.observability.logging field in metadata when you created the sandbox, query by that configuration. If the sandbox uses the log configuration of a template, query by the project and Logstore specified in the template. Set the query time range to the period when the sandbox made its access attempts. In a Logstore where indexes are enabled for these fields, search by log type and sandbox ID. Example:
logType:networkAudit AND sandboxID:"<sandbox-id>"
Check destination, destinationPort, and action in the records. allow means that the access is allowed, and deny means that the access is denied. If indexes are not configured for these fields, view the records by sandbox ID in the raw logs of the same time range.
FAQ
A template has logging enabled. How do I disable audit logs when I create a sandbox?
When you create the sandbox, in the metadata entry for fc.sandbox.observability.logging, set enableInstanceMetrics to false:
{
"metadata": {
"fc.sandbox.observability.logging": "{\"project\":\"your-project\",\"logstore\":\"your-logstore\",\"enableInstanceMetrics\":false}"
}
}
The value of this metadata entry is a JSON string. project and logstore are both required, and you can reuse the values already configured in the template. This setting takes effect for the sandbox that is being created, and it also disables instance-level metrics.
Why can I not see domain names in HTTP/HTTPS logs when only IP/CIDR rules are configured?
IP/CIDR (Classless Inter-Domain Routing) rules allow or deny access based on the destination IP. If features that require an application-layer proxy, such as credential injection, are not enabled, traffic is processed at Layer 4, and HTTP Host or TLS SNI is not parsed. Therefore, even if the sandbox accesses HTTP or HTTPS, the record is logged as tcp, and destination is the destination IP.
For example, if you configure only denyOut: ["0.0.0.0/0"] and then access https://api.example.com, the TCP connection is rejected while it is being established, so the record is logged as tcp / deny, and Host/SNI cannot be obtained.
After you configure domain-based access rules, HTTP traffic on port 80 and TLS traffic on port 443 are checked against domain names. The resolved Host or SNI value then appears in destination.
Why can I not see Host/SNI for traffic on ports other than 80 and 443?
Host/SNI is parsed only for HTTP traffic on TCP port 80 and TLS traffic on TCP port 443. Traffic that carries HTTP or HTTPS on other ports, for example http://api.example.com:8080 or https://api.example.com:8443, is still logged as TCP traffic. The destination is the destination IP instead of a domain name. UDP traffic, such as UDP on port 443, is not parsed for HTTP Host or TLS SNI either.
Why is access to port 443 sometimes logged as tcp or udp?
https means that the access is identified from handshake information such as TLS SNI. It does not mean that the TLS handshake or the HTTP request succeeded. Traffic that uses only port 443 may also be logged as tcp or udp.
When does destinationIP differ from the IP address that the proxy finally connects to?
destinationIP records the destination IP that the sandbox attempts to connect to. When the HTTP Host or TLS SNI matches a domain allowlist, the proxy resolves the domain name itself and connects to the resolved IP address. This prevents clients from bypassing the allowlist by spoofing Host or SNI. In this case, destinationIP may differ from the IP address that the proxy finally connects to.
For example, the sandbox attempts to connect to 203.0.113.10, the TLS SNI is the allowlisted domain api.example.com, and the proxy resolves the domain name and connects to 203.0.113.20. In the log, destinationIP is still 203.0.113.10, which is the address that the sandbox originally attempted to access.