Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of libvrit Log configuration

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain the example analysis of libvrit log configuration for you in detail. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

I. description of the test environment

Compiled against library: libvirt 1.2.17

Using library: libvirt 1.2.17

Using API: QEMU 1.2.17

Running hypervisor: QEMU 2.3.0

OS:CentOS 7.1

II. Detailed explanation of libvirt configuration file

Configuration file: / etc/libvirt/libvirtd.conf

#

#

# Log control

#

# Log level: 4 errors, 3 warnings, 2 information, 1 debug

# basically all log information can be recorded at debug level

# Note:

# journald locks the libvirt daemon and limits the logging level. If you want to monitor debug-level logs, you must explicitly configure them in the "log_outputs" option.

# otherwise, only information-level logs will be recorded.

# if the log level is set to 2, logs with less than 1 debug level can be obtained through log_outputs.

# by default, logs are not output to journald, nor to other places.

Log_level = 1

# log filtering:

# Log filtering allows you to select a specific log level for a given category of logs.

# filtering format can be one of the following:

# x:name

# x:+name

When the name string matches the source file name, such as "remote", "qemu", "util/json", the "+" prefix tells libvirt to record the call stack log that matches the name.

# x is the lowest level of matching logs:

# 1: DEBUG

# 2: INFO

# 3: WARNING

# 4: ERROR

#

# multiple filters can be used at the same time, as long as they are separated by spaces.

# examples are as follows:

# get warning and error messages only from the remote layer, and error messages from the event layer.

# log_filters= "3:remote 4:event"

# Log output:

# Log output can be as follows:

# the configuration format of log output is as follows:

# x:stderr

# output to standard error output

# x:syslog:name

# output to Syslog using custom name identifiers

# x:file:file_path

# output to a file in the specified path

# x:journald

# output to journald log system

# x represents the minimum log output filtering level

# 1: DEBUG

# 2: INFO

# 3: WARNING

# 4: ERROR

#

# multiple outputs can be defined at the same time, as long as they are separated by spaces.

# Note:

# make sure that the log level is greater than or equal to the configuration in log_level, otherwise it is invalid

# for example: use the libvirtd ID to record the log information above WARNING to syslog

# log_outputs= "3:syslog:libvirtd"

#

# log to both the libvirtd.log file and journald (which can be viewed through journalctl-u libvirtd).

# log_outputs= "3:file:/var/log/libvirt/libvirtd.log 3:journald"

# Debug log buffer size:

Since the global log buffer feature has been removed, this configuration option is no longer used.

# configure the appropriate log_outputs/log_ filters value to obtain the log.

# log_buffer_size = 64

III. Configuration method

1. Edit the file / etc/libvirt/libvirtd.conf, modify the following line, and output the libvirt debug log to the / var/log/libvirt/libvirtd.log file:

Log_level=1

Log_outputs= "1:file:/var/log/libvirt/libvirtd.log"

2. Restart the libvirtd service to make the configuration effective.

Service libvirtd restart

This is the end of this article on "sample analysis of libvrit log configuration". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report