Xinyu Zhao 8812c02940 add case for ubuntu when collecting logs
openstack on ubuntu has some logs named differently from
centos

Change-Id: I0f21999a32f7209d526b4296d1420baa2f9c85c5
2014-06-03 18:41:33 +00:00

120 lines
3.3 KiB
Ruby

#
# Cookbook Name:: rsyslog
# Recipe:: client
#
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
include_recipe "rsyslog"
roles="#{node[:roles]}"
if roles.gsub("\n",",").strip =~ /os-compute/
template "/etc/rsyslog.d/nova.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
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
if roles.gsub("\n",",").strip =~ /os-identity/
template "/etc/rsyslog.d/keystone.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
variables :loglist => node['rsyslog']['keystonelog']
notifies :restart, "service[rsyslog]"
end
end
if roles.gsub("\n",",").strip =~ /os-image/
template "/etc/rsyslog.d/glance.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
variables :loglist => node['rsyslog']['glancelog']
notifies :restart, "service[rsyslog]"
end
end
if roles.gsub("\n",",").strip =~ /os-block-storage/
template "/etc/rsyslog.d/cinder.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
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
if roles.gsub("\n",",").strip =~ /os-network/
template "/etc/rsyslog.d/quantum.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
variables :loglist => node['rsyslog']['quantumlog']
notifies :restart, "service[rsyslog]"
end
end
if roles.gsub("\n",",").strip =~ /os-ops-messaging/
template "/etc/rsyslog.d/messaging.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
variables :loglist => node['rsyslog']['messaginglog']
notifies :restart, "service[rsyslog]"
end
end
if roles.gsub("\n",",").strip =~ /os-ops-database/
template "/etc/rsyslog.d/database.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
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
file "/etc/rsyslog.d/server.conf" do
action :delete
notifies :reload, "service[rsyslog]"
only_if do ::File.exists?("/etc/rsyslog.d/server.conf") end
end