If an error occurs within a Deployment, you can analyze the logs of the Deployment to locate the error causes.

Prerequisites

  • The Deployment is monitored by Application Real-Time Monitoring Service (ARMS). For more information, see Overview.
  • Log Service is activated. If Log Service is not activated, log on to the Log Service console and activate Log Service by following the on-screen instructions.
  • A Log Service project is created. For more information, see Create a project.
  • A Logstore is created. For more information, see Create a Logstore.

Step 1: Associate business logs with trace IDs

  1. Log on to the ARMS console.
  2. In the left-side navigation pane, choose Application Monitoring > Applications. In the top navigation bar, select a region. On the Applications page, click the name of the application that you want to manage.
  3. In the left-side navigation pane, click Application Settings. On the page that appears, click the Custom Configuration tab.
  4. On the Custom Configuration tab, turn on Link Business Logs with TraceId in the Business Log Linking Settings section. Then, specify the project and Logstore that store the business logs to be associated with trace IDs.
    Link Business Logs with TraceId
  5. On the Custom Configuration tab, click Save in the lower-left corner.

Step 2: Query and analyze business logs

  1. Log on to the ARMS console.
  2. In the left-side navigation pane, click Container Monitoring.
  3. In the top navigation bar of the MNS console, select the region where your cluster is deployed.
  4. On the Container Monitoring page, click the name of the Kubernetes cluster for which you want to analyze logs.
  5. In the left-side navigation pane, click Log Analysis.
  6. On the Log Analysis page, perform the following operations:
    1. Enter a query statement in the search box.
      A query statement consists of a search statement and an analytic statement in the format of Search statement|Analytic statement. For more information, see Search syntax and SQL syntax and functions.
    2. Specify the time range for the query and analysis.
      You can select a relative time, set a time frame, or customize a time range.
      Note The query results may contain logs that are generated 1 minute earlier or later than the specified time range.
    3. Click Search & Analyze to view the query and analysis results.
    Analyze logs

Contact us

If you have questions about container monitoring, you can join the official DingTalk group for container monitoring (group ID: 31588365) to seek help.