You can check instance logs and application logs to handle application exceptions. Enterprise Distributed Application Service (EDAS) allows you to add log directories to favorites, view logs, and search for logs.

Add log directories to favorites

The Log Directories tab displays the default log directories of EDAS. You can add the log directories of your application to favorites.

When you add a log directory to favorites, you can also add the log directory to Log Service. This way, you can view and search for the application logs in the directory on the Search Logs page.

Note Only log directories can be added to or removed from favorites.
  1. Log on to the EDAS console.
  2. In the left-side navigation pane, click Applications. In the top navigation bar, select a region. In the upper part of the page, select a microservice namespace.
  3. On the Applications page, select Container Service or Serverless Kubernetes Cluster from the Cluster Type drop-down list, and click the name of the application that you want to manage.
  4. In the left-side navigation pane, click Logs. On the page that appears, click the Log Directories tab.
  5. In the upper-right corner of the Log Directories tab, click Add Online View.
  6. In the Add Online View dialog box, enter the directory in the Application Log Directory field, select whether to turn on Add to Log Service, and then click Add.
    Meet the following requirements when you specify the log directory of your application:
    • The full directory must contain log or logs.
    • The directory must end with a forward slash (/). This indicates that a folder is to be added.

View instance logs

After you add the log directories of your application to favorites, you can view the logs of instances and your application.

  1. On the Log Directories tab, click the icon to the left of a log directory to show the log file list. In the log file list, find a log file and click View in the Operation column.
    Note You can view log details and change the log level for the log files in the Configuration File for Log Framework folder. The log levels are TRACE, DEBUG, INFO, WARN, and ERROR in ascending order. After the log level is changed, the system displays the logs of the set level and higher levels in the lower part of the page.
  2. On the Real-time Logs page, select an instance from the ECS Instance ID/Name/IP drop-down list to view the log details of this instance.
    Click Enable Real-time Additions in the lower-right corner of the page to ensure that the latest appended content to the file has been loaded. This is similar to the tailf command.

Grant permissions on Log Service to a RAM user

For example, you want to use Log Service as a RAM user, and you want to add log directories or files to Log Service, view application logs, or perform distributed searches. In this case, you must use the Alibaba Cloud account to which the RAM user belongs to grant permissions to the RAM user in the Resource Access Management (RAM) console. Perform the following steps:

  1. Use an Alibaba Cloud account to log on to the RAM console.
  2. In the left-side navigation pane, choose Identities > Users. On the Users page, find the RAM user that you want to grant permissions and click Add Permissions in the Actions column.
  3. In the Add Permissions panel, click System Policy in the Select Policy section and enter log in the search box. Click AliyunLogReadOnlyAccess to add this permission to the Selected section on the right side and click OK.
    Note The Principal parameter is automatically specified. You do not need to set this parameter. To grant permissions to multiple RAM users, enter keywords in the Principal field to search for the RAM users that you want to add, and add them to the Principal field.
  4. In the Add Permissions panel, check the RAM user and granted permissions. After confirmation, click Complete.

Remove log directories from favorites

When you remove a log directory from favorites, the specified log directory of your application is removed. After the log directory is removed, it is no longer displayed on the Log Directories tab. You cannot view instance logs in this directory. However, this operation does not delete the actual log directory or files.

Note You can also remove a default log directory from favorites.
  1. On the Log Directories tab, select a log directory, and click Remove Log Directory from Bookmark.
  2. In the Remove Log Directory from Bookmark dialog box, verify the log directory that you want to remove, select whether to turn on Delete Project and Logstore Related with the Log, and then click Confirm.
    When you remove a log directory from favorites, you can turn on Remove Log Directory from Bookmark.
    • If the log directory is not deleted from Log Service, you can view the original application logs in this directory.
    • If the log directory is deleted from Log Service, you cannot view the original application logs in this directory.