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 Simple Log Service. This way, you can view and search for the application logs in the directory on the Search Logs page.
Only log directories can be added to or removed from favorites.
Log on to the EDAS console.
In the left-side navigation pane, click . In the top navigation bar, select a region. In the upper part of the page, select a namespace. Select Container Service or Serverless Kubernetes Cluster from the Cluster Type drop-down list. Then, find the application that you want to deploy and click the application name.
In the left-side navigation pane, click Logs. On the Logs page, click the Log Directories tab.
In the upper-right corner of the Log Directories tab, click Add Online View.
In the Add Online View dialog box, enter the directory in the Application Log Directory field, specify whether to turn on Add to Log Service, and then click Add.
Make sure that the following requirements are met 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 the application.
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.
NoteYou 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 specified level and higher levels in the lower part of the page.
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 Simple Log Service to a RAM user
For example, you want to use Simple Log Service as a Resource Access Management (RAM) user, and you want to add log directories or files to Simple 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 RAM console. To do so, perform the following operations:
Log on to the RAM console with an Alibaba Cloud account.
In the left-side navigation pane, choose . On the Users page, find the RAM user to which you want to grant permissions and click Add Permissions in the Actions column.
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 policy to the Selected section on the right side and click OK.
NoteThe 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, and add them to the Principal field.
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, the actual log directory and files are not deleted.
You can also remove a default log directory from favorites.
On the Log Directories tab, select a log directory, and click Remove Log Directory from Bookmark.
In the Remove Log Directory from Bookmark dialog box, verify the log directory that you want to remove, specify 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 Simple Log Service, you can view the original application logs in this directory.
If the log directory is deleted from Simple Log Service, you cannot view the original application logs in this directory.