Glance logging and configuration

If, after working your way through each of the preceding sections, you continue to have trouble with Glance, here are a few more elements you should check. The Glance log files will often contain clues that can assist with troubleshooting. You can determine the location of the Glance log files by checking the value of the log_file or log_dir setting in the Glance configuration file. Typically, the log files for Glance will be located in the /var/log/glance/ directory. In this directory, you should find several log files including these:

  • api.log
  • registry.log

The api.log file will likely contain a bulk of clues that you need to troubleshoot Glance. It's also worth reminding you that Glance leverages Keystone for authentication. Therefore, in addition to the Glance logs, you will want to keep an eye on the Keystone logs. Similar to the Glance logs, the Keystone logs are typically located at /var/log/keystone. Refer to Chapter 2, Troubleshooting OpenStack Identity, for more details.

The log level

When troubleshooting OpenStack, it is helpful to increase the logging level so that more information is printed on the logs. This additional information can help provide more insight into how the system is operating and may help you isolate the source of problems. To turn on debug logging for Glance, you need to modify /etc/glance/glance-api.conf. In this configuration file, there is a setting named debug and is usually located under the From oslo.log section. To turn on debugging, simply set debug = true.

Where to look

When troubleshooting Glance, it makes sense to start by looking in the Glance logs. However, remember that Glance is interconnected with other OpenStack projects. This means that the root of the problem I am troubleshooting may not be in Glance at all. Therefore, I recommend that you look for log files that have been recently modified. One way to accomplish this is using the find command to list log files that have been modified in the last 5 minutes. For example, you can run the following command from the /var/log directory to do so:

find . -iname "*.log" -mmin -1 -printf '%T+ %p
' | sort -r

An example of what the output will look like is given in the following command:

Where to look

Using this command will help you see which log files you may want to investigate for clues.

Searching logs

Again, when troubleshooting Glance, we should start with the Glance log files and then potentially investigate some of the other log files returned from your find command. Once you are ready to start searching through your log files, you can leverage your standard Linux tools to look for useful information. One of the first tools I pick up is the tail command. I typically begin by tailing the related log files. For example, when trying to fix a Glance issue, I will tail glance-api.log:

tail -f /var/log/glance/api.log

Another useful tool is grep. I know grep is often seen as a solution and a problem at the same time, but I find it useful when trying to cut through the noise of the OpenStack logs and it also useful to find the useful signals that will assist with troubleshooting. For example, you can grep the log files for the words critical, error, warning, and failure:

grep -irE 'critical|error|warning|failure' /var/log/glance/api.log

Searching the log files this way can help you quickly isolate and focus on the log lines that provide key information for troubleshooting.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset