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, search for logs, and remove logs.
Add a log directory to favorites
The Log Directory page displays the default log directories of EDAS. You can add log
directories of your applications to favorites. You can view the instance logs in a
log directory after you add the log directory to favorites. For more information,
see View instance logs.
After you add a log directory to favorites, you can add the log directory to Log Service.
Then, you can view and query the application logs in the directory on the Search Logs page.
Note Only log directories can be added to and removed from favorites.
- Log on to the EDAS console.
- 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.
- On the application details page, choose . On the Log Directory page, click Favorite Directory.
- In the Favorite Directory dialog box, enter the directory in the Application Log Directory field, turn on Add to Log Service as needed, and then click Add.
The application log directory that you enter must meet the following requirements:
- The directory must be in /home/admin.
- The full directory must contain log or logs.
- The directory must end with a slash (/). This indicates that a folder is to be added.
View instance logs
After you add an application log directory to favorites, you can view the logs of
instances and applications in the directory.
- On the application details page, choose in the left-side navigation pane.
- 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 You can view log details and change the log level for the log files in Configuration File for Log Framework. 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.
- 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 make sure that the latest appended content
to the file is added. This is similar to the tailf
command.
Add a log directory or file 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.
- If you have not created a project or a Logstore in Log Service, create a project and
a Logstore. EDAS creates a Logstore named in the format of
edas-logstore-<Absolute path of the log file>
, such as a-homeadminlogs
.
- On the application details page, choose Logs > Log Directory in the left-side navigation pane.
- 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.
- 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.
- If you select Create for the Source Method parameter, take note of the following rules when you set the parameters:
- Project: Enter the name of a project 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 to specify a specific log file 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.
- If you select Use Existing for the Source Method parameter, take note of the following rules when you set the parameters:
- 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 to specify a specific log file 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 add an application log directory to favorites and add the directory or specific
files in the directory to Log Service, you can view application logs and perform distributed
search.
- 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.
- 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.
- View application logs.
- Enter a keyword to perform distributed search in application logs.
Grant Log Service permissions to a RAM user
To use Log Service features as a RAM user, make sure that you have granted required
permissions to the RAM user by using your Alibaba Cloud account. The features include
adding log directories or files to Log Service, viewing application logs, or performing
distributed search. Perform the following steps:
- Log on to the by using your Alibaba Cloud account.
- In the left-side navigation pane, click Users. On the Users page, find the RAM user to which you want to grant permissions, such as doctest, in the user list, and click Add Permissions in the Actions column.
- In the Add Permissions panel, select System Policy under Select Policy and enter log in the search box next to it. Click AliyunLogReadOnlyAccess to add this permission to the Selected list on the right side, and then click OK.
Note The Principal parameter is automatically configured. You do not need to set this parameter. To
grant permissions to multiple RAM users, enter keywords in the field to search for
the RAM users that you want to add, and add the RAM users to the value of the Principal parameter.
- On the authorization result page, view and confirm the RAM user and the granted permission
and 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 action, the data in the Logstore is deleted and cannot be restored.
Note The default log directory cannot be removed from Log Service.
- On the Log Directory page, select a log directory or file, and click Remove from Log Service.
- 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.
If you select Delete associated projects from Log Service, the project and Logstore associated with the log directory or file are deleted.
This means that the data in the Logstore is deleted.
Remove a log directory from favorites
After you remove a log directory of your application from favorites, the log directory
is no longer displayed on the Log Directory page. You cannot view instance logs in this directory. However, this operation does
not delete the actual log directory or file.
Note You can also remove a default directory from favorites.
When you remove a log directory from favorites, 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 this 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 to remove, select Remove from Log Service as needed, and then click OK.