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

Bookmark log directories

The Log Directory page displays the default log directories of EDAS. You can bookmark directories of your applications. You can view the instance logs in a log directory after you bookmark the log directory. For more information, see View instance logs.

You can also add the log directory to Log Service after you bookmark the log directory so that the application logs in the directory can be viewed and searched on the Search Logs page.

Note Only log directories can be bookmarked and removed from bookmarks.
  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 namespace. On the Applications page, click the name of the desired application.
  3. On the application details page, choose Logs > Log Directory. On the Log Directory page, click Favorite Directory.
  4. In the Favorite Directory dialog box, enter the directory in the Application Log Directories field, turn on Add to Log Service as needed, and then click Add.
    Make sure that the following requirements are met when you enter the application log directory:
    • The directory must be in /home/admin.
    • The complete directory must contain log or logs.
    • The directory name must end with a slash (/) to indicate that it is a folder.

View instance logs

After you bookmark application logs, you can view logs of instances and applications.

  1. On the application details page, choose Logs > Log Directory in the left-side navigation pane.
  2. On the Log Directory page, click the > icon on the left of the directory that you want to view. In the log file list that expands, click View Online in the Actions column.
    Note In Files Configured in Log Framework, you can view details of a log file and change its level. 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.
  3. On the Real-time Logs page, select an instance from the ECS Instance ID/Name/IP drop-down list on the right side to view the log details of this instance.
    Click Enable Real-time Additions in the lower-right corner of the page to make sure that the latest appended content to the file is added. This is similar to the tailf command.

Add log directories or files to Log Service

Log Service allows you to view and search for application logs. You can view and search for application logs after you add log directories or files to Log Service.

When you add a log directory or file to Log Service, you can specify a project and a Logstore.

  • If you have created a project and a Logstore in Log Service, you can use the existing project and Logstore.
  • Create a project and a Logstore if you have not created a project or a Logstore in Log Service. EDAS creates a Logstore named in the format of edas-logstore-<absolute path of the log file>, such as a-homeadminlogs.
Note If you log on as a Resource Access Management (RAM) user, you must grant permissions to the RAM user by using your Alibaba Cloud account. For more information, see Grant permissions on Log Service to a RAM user.
  1. On the application details page, choose Logs > Log Directory in the left-side navigation pane.
  2. On the Log Directory page, select a log directory or file and click Add to Log Service.
    If you add a log directory to Log Service, all log files in this directory are added to Log Service by default. You can perform distributed search only in the log directory, but cannot perform distributed search for specific log files in the directory. If you want to perform distributed search for specific log files, we recommend that you do not add the entire directory to Log Service.
  3. In the Add to Log Service dialog box, confirm the log directory, set the parameters, and then click Add.
    • Application Log Directory: the selected log directory, which cannot be modified.
    • Source Method: If you select Create:
      • Project: Enter the project name in the format of edas-project-<region-id-timestamp>, such as edas-project-cn-qingdao-.
      • Logstore: Enter the name of a Logstore in the format of edas-logstore-<absolute path of the log file>, such as a-homeadminlogs.
      • Log Path: If you need some log files in the directory, enter a keyword of the file name or the complete file name. You can enter a complete file name or part of the name with wildcards.
    • Source Method: If you select Use Existing:
      • Project: Select an existing project from the drop-down list.
      • Logstore: Select an existing Logstore from the drop-down list.
      • Log Path: If you need some log files in the directory, enter a keyword of the file name or the complete file name. You can enter a complete file name or part of the name with wildcards.

View application logs and perform distributed search

After you bookmark the application log directory and add the directory or file to Log Service, you can view the application logs and perform distributed search.

Note If you log on as a RAM user, you must grant permissions to the RAM user by using your Alibaba Cloud account. For more information, see Grant permissions on Log Service to a RAM user.
  1. On the application details page, choose Logs > Search Logs in the left-side navigation pane.
    If you have added a log file to Log Service, you can also click Search in the Actions column on the Log Directory page.
  2. On the Search Logs page, click the drop-down arrow next to Log File, and select a log directory or a log file from the drop-down list.
  3. View application logs.
  4. Enter a keyword to perform distributed search in application logs.

Grant permissions on Log Service to a RAM user

If you are a RAM user, you must use Log Service as the RAM user, including adding log directories or files to Log Service, viewing application logs, or performing distributed search. In addition, you must use an Alibaba Cloud account to authorize the RAM user in the RAM console. Perform the following steps:

  1. Log on to the RAM console by using an Alibaba Cloud account.
  2. In the left-side navigation pane, click Users. On the Users page, find the RAM user such as doctest in the user list, and click Add Permissions in the Actions column.
  3. In the Add Permissions panel, select System Policy for Select Policy and enter log in the search box below System Policy. Click AliyunLogReadOnlyAccess to add this permission to the Selected list on the right side, and click OK.
    Note Principal is loaded by default and does not need to be set. To grant permissions to multiple RAM users, enter keywords in the search box and search for and add the RAM users in the Principal field.
  4. In the Add Permissions panel, view the RAM user and the granted permission, and then click Complete.

Remove the specified log directory or file from Log Service

You can remove the specified log directory or file from Log Service. The log directory or file is removed only from Log Service but is not deleted. This operation involves two actions:

  • Remove a log directory or file from the collection rules of Log Service: After the log directory or file is removed, Log Service no longer collects new data.

  • Remove a log directory or file from the collection rules of Log Service and delete associated objects from Log Service: After the log directory or file is removed, Log Service no longer collects new data. In addition, when the associated objects including the project and Logstore are no longer used by other applications, they will be removed from Log Service. If you perform this operation, the data in the Logstore is deleted and cannot be restored.

Note The default log directory cannot be removed from Log Service.
  1. On the Log Directory page, select a log directory or file, and click Remove from Log Service.
  2. In the Remove from Log Service dialog box, confirm the log directory or file that you want to delete, select Delete associated projects from Log Service as needed, and then click OK.
    Delete associated projects from Log Service: The project and Logstore associated with the log are deleted. This means that the data in the Logstore is deleted.

Remove log directories from bookmarks

When you remove a log directory from bookmarks, the specified log directory is removed. After the log directory is removed, it is no longer displayed on the Log Directory page. You can no longer view instance logs in this directory, but the log directory and files are not deleted.

Note A default directory can also be removed from bookmarks.

When you remove a log directory from bookmarks, you can also select Remove from Log Service.

  • If the log directory is not removed from Log Service, you can view the original application logs in the directory.
  • If the log directory is removed from Log Service, you cannot view the application logs in this directory.
  • On the Log Directory page, select a log directory, and click Remove from Favorites.
  • In the Remove from Favorites dialog box, confirm the log directory that you want o remove, select Delete associated projects from the Log Service as needed, and then click OK.