Updated on 2025-05-14 GMT+08:00

Viewing VPN Connection Logs

Scenario

After the VPN logging function is enabled, you can view the logs of a specified VPN connection.

Prerequisites

The Log Tank Service (TLS) has been enabled. For details, see Getting Started with TLS.

Procedure

  • Creating a log group
    1. Log in to the management console.
    2. Click in the upper left corner and select the desired region and project.
    3. Click in the upper left corner of the page, and choose Management & Governance > Log Tank Service.
    4. Create a log group. For details, see Managing Log Groups .
  • Creating a log stream
    1. Log in to the management console.
    2. Click in the upper left corner and select the desired region and project.
    3. Click in the upper left corner of the page, and choose Management & Governance > Log Tank Service.
    4. Create a log stream. For details, see Managing Log Streams.
  • Configuring the connection log function
    1. Log in to the management console.
    2. Click in the upper left corner and select the desired region and project.
    3. Click in the upper left corner, and choose Networking > Virtual Private Network.
    4. In the navigation pane on the left, choose Virtual Private Network > Enterprise – VPN Gateways.
    5. Click the P2C VPN Gateways tab. In the P2C VPN gateway list, locate the target P2C VPN gateway, and click View Server in the Operation column.
    6. Click the Connections tab. The VPN connection details page is displayed.
    7. In the Connection Log area, click Configure Connection Log.
    8. In the dialog box that is displayed, toggle on Collect Logs.
    9. Select the target log group and log stream, and click OK.

      On the Connections tab page, you can view the configured connection log.

  • Viewing connection logs
    1. Log in to the management console.
    2. Click in the upper left corner and select the desired region and project.
    3. Click in the upper left corner, and choose Networking > Virtual Private Network.
    4. In the navigation pane on the left, choose Virtual Private Network > Enterprise – VPN Gateways.
    5. Click the P2C VPN Gateways tab. In the P2C VPN gateway list, locate the target P2C VPN gateway, and click View Server in the Operation column.
    6. Click the Connections tab. The VPN connection details page is displayed.
    7. In the Connection Log area, click View Log Details. The LTS page is displayed.
    8. In the log group list, click on the left of the target log group to view log stream details.
    9. Click a log stream name to view log details, including the time and log content.

      The log format is as follows:

      $p2c_vgw_id $connection_id $client_public_ip $client_private_ip $client_user_name $event_type $event_timestamp
      Table 1 Description of the log format

      Parameter

      Description

      p2c_vgw_id

      Gateway ID

      connection_id

      Connection ID

      client_public_ip

      Actual address

      client_private_ip

      Virtual address

      client_user_name

      Username

      event_type

      Online/Offline event type

      event_timestamp

      Timestamp

      You can search for logs by keyword on the log stream details page on the LTS console.