Configuring Default Log Level and Archive File Size for MRS Components
During MRS cluster O&M and troubleshooting, administrators need to check component logs to locate faults and analyze issues. However, the default log level may generate a large amount of unnecessary log data, making it difficult to identify critical errors among massive logs. In addition, continuously growing log files may consume excessive disk space and affect normal cluster operation. By adjusting log levels, administrators can control the amount of log information generated. During troubleshooting, the DEBUG level can be enabled to collect detailed diagnostic information. During normal operation, the INFO level is recommended to reduce log volume. By configuring the log archive file size, administrators can control the disk space consumed by logs and prevent log storage failures caused by insufficient disk space. This section describes how to change the log level and archive file size of MRS Manager and each service component.
- Log level: Controls the level of detail in log output. From highest to lowest priority, log levels are FATAL, ERROR, WARN, INFO, DEBUG, and TRACE. When a log level is configured, logs at that level and higher priority levels are recorded. The lower the configured log level, the more logs are generated. For example, when the log level is set to WARN, only WARN, ERROR, and FATAL logs are generated. When the log level is set to DEBUG, logs at the DEBUG level and higher levels are generated.
- Archive File Size: Specifies the maximum size of a single log file. When a log file reaches the configured size, the system automatically performs log rotation, archives the current log file, and creates a new log file. Proper archive file size settings help control the total disk space consumed by logs.
The log framework of each component determines whether to output a log message based on the configured log level. Only log messages with a priority equal to or higher than the configured level are recorded. For archive file size, the log framework continuously monitors the size of the current log file. When the file size reaches the configured threshold, the current log file is renamed as an archive file, and a new log file is created for subsequent writes. The system automatically deletes expired archive files based on the configured retention policy.
Notes and Constraints
- This section applies only to MRS 3.x or later.
- The log level of some services cannot be changed on the console.
Impact on the System
- The services need to be restarted for the new configuration to take effect. During the restart, the services are unavailable.
- If the log level is set to DEBUG or TRACE, a large number of logs will be generated, which may affect system performance and disk space. Therefore, restore the log level to INFO after the fault is rectified.
Changing the Manager Log Level
- Log in to the active management node as user root.
Run the following command to switch to user omm:
su - omm
- Run the following command to switch to the required directory:
cd ${BIGDATA_HOME}/om-server/om/sbin - Run the following command to change the log level:
./setLogLevel.sh Log level parameters
The priorities of log levels are FATAL, ERROR, WARN, INFO, and DEBUG in descending order. Logs whose levels are higher than or equal to the set level are printed. The number of printed logs decreases as the configured log level increases.
- DEFAULT: After this parameter is set, the default log level is used.
- FATAL: critical error log level. After this parameter is set, only logs of the FATAL level are printed.
- ERROR: error log level. After this parameter is set, logs of the ERROR and FATAL levels are printed.
- WARN: warning log level. After this parameter is set, logs of the WARN, ERROR, and FATAL levels are printed.
- INFO (default): informational log level. After this parameter is set, logs of the INFO, WARN, ERROR, and FATAL levels are printed.
- DEBUG: debugging log level. After this parameter is set, logs of the DEBUG, INFO, WARN, ERROR, and FATAL levels are printed.
- TRACE: tracing log level. After this parameter is set, logs of the TRACE, DEBUG, INFO, WARN, ERROR, and FATAL levels are printed.
The log levels of components are different from those defined in open-source code.
- Download and view logs to verify that the log level settings have taken effect. For details, see Downloading MRS Cluster Logs (MRS 3.x or Later).
Changing the Service Log Level and Log File Size
- Log in to FusionInsight Manager of the MRS cluster.
For details about how to log in to FusionInsight Manager, see Accessing MRS Manager.
- Choose Cluster > Services.
- Click a service in the service list. On the displayed page, click the Configuration page.
- On the displayed page, click the All Configuration tab. Expand the role instance displayed on the left of the page. Click Log of the role to be modified.
- Search for each parameter and obtain the parameter description. On the parameter configuration page, select the required log level or change the log file size. The unit of the log file size is MB.
- The system automatically deletes logs based on the configured log size. To save more logs, set a larger log file size. To ensure the integrity of log files, you are advised to manually back up the log files to another directory based on the actual service volume before the log files are cleared based on clearance rules.
- The log level of some services cannot be changed on the console.
- The log level and log file size of KrbServer, LdapServer, and DBService cannot be changed.
- Click Save. In the Save Configuration dialog box, click OK.
- Download and view logs to verify that the log level settings have taken effect.
Verification:
After the modification, download and view the log file of the corresponding service. If the log level in the log file is the same as the configured level (for example, no INFO-level information is displayed in the log after the log level is set to WARN), the configuration has taken effect. Check whether the size of the log file meets the specified archive threshold.
FAQs
- What should I do if the disk space becomes insufficient because excessive logs are generated after the log level is changed?
After the log level is set to DEBUG or TRACE, the system generates a large amount of debugging information. The log files grow much faster than they do at the INFO level, which may quickly consume available disk space.
After troubleshooting is complete, restore the log level to INFO or WARN in a timely manner. You can also reduce the archive file size to accelerate the cleanup of expired logs. If the disk is full, manually delete old archived log files to release disk space.
- What should I do if the log level change is not applied?
After changing the service log level, you need to restart the service for the change to take effect. If the service is not restarted, the new configuration is saved only in the database, and the old configuration is still used. The log level of some services cannot be changed on the console.
Verify that the service has been restarted after the configuration is saved.
Helpful Links
- For details about how to download MRS cluster alarms, see Downloading MRS Cluster Logs.
- For details about how to synchronize MRS cluster configurations, see Synchronizing the MRS Cluster Configuration.
- For details about how to view MRS cluster alarms, see Viewing Alarms of an MRS Cluster.