OpenStack的日志管理介绍

本文是从OpenStack官网翻译出来,从多个方面描述了OpenStack在日志分析和日志管理方面的内容,可以供大家参考学习 。
一、日志的位置大多数服务都默认将日志写入子目录为/var/log,下面为OpenStack各服务的位置列表 。
Node type
Service
Log location
Cloud controller
nova-*
/var/log/nova
Cloud controller
glance-*
/var/log/glance
Cloud controller
cinder-*
/var/log/cinder
Cloud controller
keystone-*
/var/log/keystone
Cloud controller
neutron-*
/var/log/neutron
Cloud controller
horizon
/var/log/Apache2/
All nodes
misc (swift, DNSmasq)
/var/log/syslog
Compute nodes
libvirt
/var/log/libvirt/libvirtd.log
Compute nodes
Console (boot up messages) for VM instances:
/var/lib/nova/instances/instance-<instance id>/console.log
Block Storage nodes
cinder-volume
/var/log/cinder/cinder-volume.log
 
二、日志查阅OpenStack服务使用标准的loggin级别,严重程度逐渐增高,如TRACE, DEBUG, INFO, AUDIT, WARNING, ERROR, and CRITICAL 。也就是说,只有当日志消息比特定日志级别更高时才出现在日志文件中,Debug允许所有日志语句通过 。例如,仅当软件具有堆栈跟踪时才记录跟踪,而记录每条日志消息的信息,包括仅用于提供info的日志消息 。
关闭DEBUG-level日志记录,编辑/etc/nova/nova.conf 文件如下
Debug=false
keystone的处理有些不同,修改logging级别,编辑
/etc/keystone/logging.conf文件,看logger_root和handler_file部分 。

OpenStack的日志管理介绍

文章插图
 

OpenStack的日志管理介绍

文章插图
 
而Horizon的logging配置在
/etc/openstack_dashboard/local_settings.py,因为horizon是一个Django网页应用,遵守Dango logging framework约定 。
查找错误源的第一步通常是从日志文件底部开始搜索日志中的关键或错误信息 。
下面是一个日志消息的实例,其中紧接着出现了响应的错误(Python traceback):
2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.server [req-c0b38ace-2586-48ce-9336-6233efa1f035 6c9808c2c5044e1388a83a74da9364d5 e07f5395c2eb428cafc41679e7deeab1 - default default] Exception during message handling2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.server Traceback (most recent call last):2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverFile "/openstack/venvs/cinder-14.0.0/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 133, in _process_incoming2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverres = self.dispatcher.dispatch(message)2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverFile "/openstack/venvs/cinder-14.0.0/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 150, in dispatch2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverreturn self._do_dispatch(endpoint, method, ctxt, args)2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverFile "/openstack/venvs/cinder-14.0.0/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 121, in _do_dispatch2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverresult = func(ctxt, **new_args)2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverFile "/openstack/venvs/cinder-14.0.0/lib/python2.7/site-packages/cinder/volume/manager.py", line 4366, in create_volume2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverallow_reschedule=allow_reschedule, volume=volume)2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverFile "/openstack/venvs/cinder-14.0.0/lib/python2.7/site-packages/cinder/volume/manager.py", line 634, in create_volume2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.server_run_flow()2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverFile "/openstack/venvs/cinder-14.0.0/lib/python2.7/site-packages/cinder/volume/manager.py", line 626, in _run_flow2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverflow_engine.run()2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverFile "/openstack/venvs/cinder-14.0.0/lib/python2.7/site-packages/taskflow/engines/action_engine/engine.py", line 247, in run2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverfor _state in self.run_iter(timeout=timeout):2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverFile "/openstack/venvs/cinder-14.0.0/lib/python2.7/site-packages/taskflow/engines/action_engine/engine.py", line 340, in run_iter2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverfailure.Failure.reraise_if_any(er_failures)2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverFile "/openstack/venvs/cinder-14.0.0/lib/python2.7/site-packages/taskflow/types/failure.py", line 336, in reraise_if_any2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverfailures[0].reraise()2017-01-18 15:54:00.467 32552 ERROR oslo_messaging.rpc.serverFile "/openstack/venvs/cinder-14.0.0/lib/python2.7/site-packages/taskflow/types/failure.py", line 343, in reraise


推荐阅读