Teach you to read the OpenStack logs-5 minutes a day to play OpenStack (29)

Source: Internet
Author: User

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160503-1462278374898013082.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160503-1462278429940030293.jpg "style=" border:0px;float:none; "/>

The entire life cycle of instance from creation to deletion is managed by Nova. In the following sections, we take the different operational scenarios in the instance life cycle as an example to analyze in detail how the different Nova components work together and deepen your understanding of Nova through log analysis.

Before we study Nova's operations, let's start by learning one important thing: the OpenStack logs.
OpenStack's log records very detailed details and is a powerful tool for learning and troubleshoting.

location of the log

Our experimental environment uses DEVSTACK, logs are unified in the/opt/stack/logs directory, each service has its own log files, from the name is easy to distinguish.

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160503-1462278374920073046.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160503-1462278430120083017.jpg "style=" border:0px;white-space:normal;float:none; "/>

For example nova-* each sub-service log to start with "n": N-api.log is Nova-api log n-cpu.log is Nova-compute log.

Glance log files are "G" beginning: G-api.log is Glance-api log g-reg.log is glance-registry log.

The logs of Cinder and Neutron begin with "C" and "Q" respectively.

For OpenStack that is not devstack installed, the log is typically placed in the/var/log/xxx/directory. For example, Nova placed under the/var/log/nova/, Glance placed under the/var/log/glance ...

The log files for each sub-service are also saved separately, and the naming is also very canonical and easy to distinguish. For example, Nova-api's log is generally named/var/log/nova/api.log, and other logs are similar.

format of the log

The log format for OpenStack is uniform, as follows

< time stamp; < code module, <request Id> < log content >< source code location;

timestamp The time of the logging, including the day of the year and the millisecond
log level There is info WARNING ERROR Debug and so on
code module the module currently running Span style= "Margin:0px;padding:0px;border:0px;color: #800080;" The >request ID log records successive different operations, each of which is assigned a unique Request ID for ease of differentiation and readability, and is easy to find
Log content This is the body of the log, recording important information such as the actions and results that are currently being performed
Span style= "Margin:0px;padding:0px;border:0px;color: #FF0000;" > source code location the location of the log code, including the method name, the directory location and line number of the source code file. Not all logs have

The following examples illustrate

2015-12-10 20:46:49.566DEBUGNova.virt.libvirt.config[req-5c973fff-e9ba-4317-bfd9-76678cc96584 None None]Generated XML (' <cpu>\n <arch>x86_64</arch>\n <model>westmere</model>\n <vendor >intel</vendor>\n <topology sockets= "2" cores= "3" threads= "1"/>\n <feature name= "AVX"/>\n < Feature Name= "DS"/>\n <feature name= "HT"/>\n <feature name= "hypervisor"/>\n <feature name= "Osxsave" />\n <feature name= "PCLMULDQ"/>\n <feature name= "RDTSCP"/>\n <feature name= "ss"/>\n <feature N Ame= "VME"/>\n <feature name= "Xsave"/>\n</cpu>\n ",)to_xml/opt/stack/nova/nova/virt/libvirt/config.py:82

This log we can learn:

    1. code module is Nova.virt.libvirt.config, it should be Hypervisor libvirt related operation

    2. If you want to trace the source code, you can go to line 82 of/opt/stack/nova/nova/virt/libvirt/config.py, by To_xml

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160503-1462278374917072471.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160503-1462278430248004972.jpg "style=" border:0px;white-space:normal;float:none; "/>

Another example is the following log:

2015-12-10 20:46:49.671 ERROR Nova.compute.manager [req-5c973fff-e9ba-4317-bfd9-76678cc96584 None None] No compute node record for host Devstack-controller

This log we can learn:

    1. This is an ERROR log

    2. Specific content is "No compute node record for host Devstack-controller"

    3. The log does not indicate the source code location

a few notes about the log
  1. Do I need to read the logs to learn OpenStack? The answer to this question depends on who you are. If you are only an OpenStack end user, then the log is not important to you. You only need to operate on the GUI, if the problem directly to find the administrator. But if you're an OpenStack operations and Management officer, the logs are very important to you. Since OpenStack operations are error-prone, the error messages given on the GUI are very general and concise, and the logs provide a lot of clues, especially when the debug option is turned on. If you are in the learning phase of OpenStack, as we are now, it is highly recommended that you look at the logs too. Logs can help you gain a deeper understanding of how OpenStack works.

  2. Logs can help us learn more about OpenStack and troubleshoot problems. But there's a prerequisite for efficient use of the log: You must first master the operation of OpenStack and then view the logs accordingly. Take Instance Launch operation, if previously did not understand the nova-* sub-services in the operation of the collaborative relationship, if not understand the flowchart, faced with so many and scattered log files, we are very difficult to start.

  3. For OpenStack operations and administrators, in most cases, we don't need to look at the source code. Because OpenStack logs are detailed enough to help us analyze and locate the problem. But there are still some detail logs that are not documented and can be understood more clearly by looking at the source code if necessary. Even so, the log will provide us with clues to source code, and we don't need to find a needle in the haystack. This is what we'll see in the operational analysis that follows.

    650) this.width=650; "title=" "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160503-1462278430411006088.jpg "style=" Border:0px;vertical-align:middle;color:rgb ( 63,63,63); font-family: ' Microsoft Yahei '; Font-size:15px;line-height:21.75px;text-align:justify;white-space: Normal;background-color:rgb (246,246,246); "/>

Teach you to read the OpenStack logs-5 minutes a day to play OpenStack (29)

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.