From 8812c02940a8aea7925fb26f7ef2396d0ea6e6ce Mon Sep 17 00:00:00 2001 From: Xinyu Zhao <zhaoxinyu@huawei.com> Date: Tue, 3 Jun 2014 00:25:07 +0000 Subject: [PATCH] add case for ubuntu when collecting logs openstack on ubuntu has some logs named differently from centos Change-Id: I0f21999a32f7209d526b4296d1420baa2f9c85c5 --- chef/cookbooks/rsyslog/attributes/default.rb | 18 ++++++++++++----- chef/cookbooks/rsyslog/recipes/client.rb | 21 +++++++++++++++++--- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/chef/cookbooks/rsyslog/attributes/default.rb b/chef/cookbooks/rsyslog/attributes/default.rb index 13180e9..6372c29 100644 --- a/chef/cookbooks/rsyslog/attributes/default.rb +++ b/chef/cookbooks/rsyslog/attributes/default.rb @@ -26,15 +26,23 @@ default["rsyslog"]["novalog"] = {:"nova-api"=>"/var/log/nova/api.log", :"nova-conductor"=>"/var/log/nova/conductor.log", :"nova-compute"=>"/var/log/nova/compute.log", :"nova-scheduler"=>"/var/log/nova/scheduler.log"} +default["rsyslog"]["debiannovalog"] = {:"nova-api"=>"/var/log/nova/nova-api.log", + :"nova-conductor"=>"/var/log/nova/nova-conductor.log", + :"nova-compute"=>"/var/log/nova/nova-compute.log", + :"nova-scheduler"=>"/var/log/nova/nova-scheduler.log"} default["rsyslog"]["glancelog"] = {:"glance-api"=>"/var/log/glance/api.log", :"glance-reg"=>"/var/log/glance/registry.log"} default["rsyslog"]["cinderlog"] = {:"cinder-api"=>"/var/log/cinder/api.log", - :"cinder-scheduler"=>"/var/log/cinder/scheduler.log", - :"cinder-volume"=>"/var/log/cinder/volume.log"} + :"cinder-scheduler"=>"/var/log/cinder/scheduler.log", + :"cinder-volume"=>"/var/log/cinder/volume.log"} +default["rsyslog"]["debiancinderlog"] = {:"cinder-api"=>"/var/log/cinder/cinder-api.log", + :"cinder-scheduler"=>"/var/log/cinder/cinder-scheduler.log", + :"cinder-volume"=>"/var/log/cinder/cinder-volume.log"} default["rsyslog"]["quantumlog"] = {:"quantum-server"=>"/var/log/quantum/server.log", - :"quantum-dhcp"=>"/var/log/quantum/dhcp-agent.log", - :"quantum-l3agent"=>"/var/log/quantum/l3-agent.log", - :"quantum-ovsagent"=>"/var/log/quantum/openvswitch-agent.log"} + :"quantum-dhcp"=>"/var/log/quantum/dhcp-agent.log", + :"quantum-l3agent"=>"/var/log/quantum/l3-agent.log", + :"quantum-ovsagent"=>"/var/log/quantum/openvswitch-agent.log"} default["rsyslog"]["keystonelog"] = {:"keystone"=>"/var/log/keystone/keystone.log"} default["rsyslog"]["messaginglog"] = {:"rabbitmq"=>"/var/log/rabbitmq/rabbit\@#{node['hostname']}.log"} default["rsyslog"]["mysqllog"] = {:"mysqld"=>"/var/log/mysqld.log"} +default["rsyslog"]["debianmysqllog"] = {:"mysqld"=>"/var/log/mysql.log"} diff --git a/chef/cookbooks/rsyslog/recipes/client.rb b/chef/cookbooks/rsyslog/recipes/client.rb index 224a955..591f912 100644 --- a/chef/cookbooks/rsyslog/recipes/client.rb +++ b/chef/cookbooks/rsyslog/recipes/client.rb @@ -26,7 +26,12 @@ if roles.gsub("\n",",").strip =~ /os-compute/ owner "root" group "root" mode 0644 - variables :loglist => node['rsyslog']['novalog'] + case node["platform_family"] + when "debian" + variables :loglist => node['rsyslog']['debiannovalog'] + when "rhel" + variables :loglist => node['rsyslog']['novalog'] + end notifies :restart, "service[rsyslog]" end end @@ -59,7 +64,12 @@ if roles.gsub("\n",",").strip =~ /os-block-storage/ owner "root" group "root" mode 0644 - variables :loglist => node['rsyslog']['cinderlog'] + case node["platform_family"] + when "debian" + variables :loglist => node['rsyslog']['debiancinderlog'] + when "rhel" + variables :loglist => node['rsyslog']['cinderlog'] + end notifies :restart, "service[rsyslog]" end end @@ -92,7 +102,12 @@ if roles.gsub("\n",",").strip =~ /os-ops-database/ owner "root" group "root" mode 0644 - variables :loglist => node['rsyslog']['mysqllog'] + case node["platform_family"] + when "debian" + variables :loglist => node['rsyslog']['debianmysqllog'] + when "rhel" + variables :loglist => node['rsyslog']['mysqllog'] + end notifies :restart, "service[rsyslog]" end end