Commit 3be02e7c authored by Joseph Anthony Pasquale Holsten's avatar Joseph Anthony Pasquale Holsten Committed by Tim Smith
Browse files

add file_input lwrp

parent c5d19ad5
......@@ -100,6 +100,39 @@ For example, to change this to just the hostname, set the attribute `node['rsysl
At this time, the server can only listen on UDP *or* TCP.
<<<<<<< HEAD
=======
Resources
=========
file_input
----------
Configures a (text file input
monitor)[http://www.rsyslog.com/doc/imfile.html] to push a log file into
rsyslog.
Attributes:
* `name`: name of the resource, also used for the syslog tag. Required.
* `file`: file path for input file to monitor. Required.
* `priority`: config order priority. Defaults to `99`.
* `severity`: syslog severity. Must be one of `emergency`, `alert`,
`critical`, `error`, `warning`, `notice`, `info` or `debug`. If
undefined, rsyslog interperets this as `notice`.
* `facility`: syslog facility. Must be one of `auth`, `authpriv`,
`daemon`, `cron`, `ftp`, `lpr`, `kern`, `mail`, `news`, `syslog`,
`user`, `uucp`, `local0`, ... , `local7`. If undefined, rsyslog
interperets this as `local0`.
* `cookbook`: cookbook containing the template. Defaults to `rsyslog`.
* `source`: template file source. Defaults to `file-input.conf.erb`
Usage
=====
Use `recipe[rsyslog]` to install and start rsyslog as a basic
configured service for standalone systems.
>>>>>>> add file_input lwrp
Usage
-----
......@@ -109,7 +142,13 @@ Use `recipe[rsyslog::client]` to have nodes log to a remote server (which is fou
Use `recipe[rsyslog::server]` to set up a rsyslog server. It will listen on `node['rsyslog']['port']` protocol `node['rsyslog']['protocol']`.
<<<<<<< HEAD
If you set up a different kind of centralized loghost (syslog-ng, graylog2, logstash, etc), you can still send log messages to it as long as the port and protocol match up with the server software. See __Examples__
=======
Use `rsyslog_file_input` within your recipes to forward log files to
your remote syslog server.
>>>>>>> add file_input lwrp
### Examples
......
# Cookbook Name:: rsyslog
# Provider:: file_input
#
# Copyright 2012, Joseph Holsten
#
# 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.
#
action :create do
template "/etc/rsyslog.d/#{new_resource.priority}-#{new_resource.name}.conf" do
mode 0664
owner node['rsyslog']['user']
group node['rsyslog']['group']
source new_resource.source
cookbook new_resource.cookbook
variables 'file_name' => new_resource.file,
'tag' => new_resource.name,
'state_file' => new_resource.name,
'severity' => new_resource.severity,
'facility' => new_resource.facility
notifies :restart, resources(:service => "rsyslog")
end
end
# Cookbook Name:: rsyslog
# Resource:: file_input
#
# Copyright 2012, Joseph Holsten
#
# 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.
#
actions :create
default_action :create
attribute :name, :kind_of => String, :name_attribute => true, :required => true
attribute :file, :kind_of => String, :required => true
attribute :priority, :kind_of => Integer, :default => 99
attribute :severity, :kind_of => String
attribute :facility, :kind_of => String
attribute :cookbook, :kind_of => String, :default => 'rsyslog'
attribute :source, :kind_of => String, :default => 'file-input.conf.erb'
# <%= @tag %>.conf - Syslog file inputs for <%= @tag %>
#
# Generated by Chef for <%= node['fqdn'] %>
# Local modifications will be overwritten.
$ModLoad imfile
$InputFileName <%= @file_name %>
$InputFileTag <%= @tag %>:
$InputFileStateFile <%= @state_file %>
<% if @severity %>
$InputFileSeverity <%= @severity %>
<% end %>
<% if @facility %>
$InputFileFacility <% @facility %>
<% end %>
$InputRunFileMonitor
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment