-
-
Save danielsdeleo/797678 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from rsyslog::default.rb: | |
# move this into the provider.... | |
# service "rsyslog" do | |
# supports :restart => true, :reload => true | |
# action [:enable, :start] | |
# end | |
# from rsyslog/providers/imfile.rb: | |
action :create do | |
service "rsyslog" do | |
supports :restart => true, :reload => true | |
# change this to: | |
# action :nothing | |
# if you're going to manage the service's enable/started status elsewhere | |
action [:enable, :start] | |
end | |
template "/etc/rsyslog.d/#{new_resource.tag}.conf" do | |
source "imfile-stanza.erb" | |
cookbook "rsyslog" | |
owner "root" | |
group "root" | |
mode 0644 variables ( | |
:location => new_resource.location, | |
:tag => new_resource.tag, | |
:facility => new_resource.facility, | |
:priority => new_resource.priority, | |
:label => new_resource.label | |
) | |
# I think this should work, but if not, use the resources() syntax | |
notifies :reload, "service[rsyslog]", :delayed | |
end | |
end | |
# From rsyslog/resources/textlog.rb: | |
actions :create, :delete | |
attribute :location, :required => true, :kind_of => String | |
attribute :tag, :required => true | |
attribute :facility, :kind_of => String | |
attribute :priority, :kind_of => String | |
attribute :label, :kind_of => String | |
# From the calling cookbook: | |
# Set up textfile logging for the main nginx error log | |
rsyslog_textlog "nginx-error" do | |
location "/opt/nginx/logs/error.log" | |
tag "nginx-main-error" | |
facility "user" | |
priority "err" | |
label "main nginx error log" | |
action :create | |
provider "rsyslog_imfile" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment