Enable the log feature of Open vSwitch in Linux for debugging and troubleshooting

Source: Internet
Author: User

Enable the log feature of Open vSwitch in Linux for debugging and troubleshooting

I tried to deploy troubleshooting for my Open vSwitch. In view of this, I want to check its debugging information generated by the built-in log mechanism. How can I enable the log function of Open vSwitch and modify its log level (for example, to INFO/DEBUG level) to check more detailed debugging information?

Open vSwitch (OVS) is the most popular Open-source Virtual Switch on Linux. Because today's data centers are increasingly dependent on the SDN architecture, OVS is rapidly applied as a network element in the SDN deployment of data centers.

Open vSwitch has a built-in Log Mechanism, which is called VLOG. VLOG allows you to enable and customize logs in various network switching components. The log information generated by VLOG can be sent to a console, syslog, and a separate log file that is easy to view. You canovs-appctlThe command line tool for dynamic configuration of OVS logs at runtime.

Here we will show you how to useovs-appctlEnable and customize the log function in Open vSwitch.

Below isovs-appctlCustom VLOG syntax.

  1. $ sudo ovs-appctl vlog/setmodule[:facility[:level]]
  • Module: name of any valid component in OVS (such as netdev, ofproto, dpif, vswitchd, etc)
  • Facility: log information destination (must be console, syslog, or file)
  • Level: log details (must be emer, err, warn, info, or dbg)

In OVS source code, the module name is defined in the following format in the source file:

  1. VLOG_DEFINE_THIS_MODULE(<module-name>);

For example, in lib/netdev. c, you can see:

  1. VLOG_DEFINE_THIS_MODULE(netdev);

This indicates that lib/netdev. c is part of the netdev module, and any log information generated in lib/netdev. c will belong to the netdev module.

In OVS source code, multiple severity levels are used to define several different types of log information: VLOGINFO () for reporting, VLOGWARN () is used for warning, VLOGERR () is used for error message, VLOGDBG () is used for debugging information, and VLOG_EMERG is used for emergencies. Log Level and tool determine which log information is sent.

To view the complete list of available modules, tools, and their respective log levels, run the following command. This command must be called after you start OVS.

  1. $ sudo ovs-appctl vlog/list

The output shows the debugging level of each module used in three scenarios (facility: console, syslog, file. By default, the log level of all modules is set to INFO.

Specify any OVS module, and you can selectively modify the debugging level for any specific scenario. For example, if you want to view more detailed debugging information of dpif on the console screen, you can run the following command.

  1. $ sudo ovs-appctl vlog/set dpif:console:dbg

You will see that the dpif console tool has changed its log level to DBG, while the Log Level of syslog and file has not changed in the other two scenarios.

If you want to modify the log level of all modules, you can specify "ANY" as the module name. For example, the following command modifies the Log Level of the console of each module to DBG.

  1. $ sudo ovs-appctl vlog/set ANY:console:dbg

At the same time, if you want to modify the log level of all three occasions at a time, you can specify "ANY" as the occasion name. For example, the following command modifies the log level of all scenarios of each module to DBG.

  1. $ sudo ovs-appctl vlog/set ANY:ANY:dbg

Via: http://ask.xmodulo.com/enable-logging-open-vswitch.html

Author: Dan Nanni Translator: GOLinux Proofreader: wxy

This article was originally translated by LCTT and launched with the Linux honor in China

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.