forked from saltstack-formulas/rsyslog-formula
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Martin Hoefling
committed
Sep 2, 2014
0 parents
commit adca1f4
Showing
7 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM martinhoefling/salt-minion:debian | ||
MAINTAINER Martin Hoefling <[email protected]> | ||
# push formula | ||
ADD rsyslog /srv/salt/rsyslog | ||
ADD pillar.example /srv/pillar/example.sls | ||
RUN echo "file_client: local" > /etc/salt/minion.d/local.conf | ||
RUN echo "base:" > /srv/pillar/top.sls | ||
RUN echo " '*':" >> /srv/pillar/top.sls | ||
RUN echo " - example" >> /srv/pillar/top.sls | ||
RUN salt-call --local state.sls rsyslog | tee log.txt && grep "Failed: 0" log.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Kenny Do | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
rsyslog-formula | ||
=============== | ||
|
||
Configures and starts rsyslog service. Currently the log file schema is based on the debian default. The formula allows | ||
control if rsyslog should listen for tcp / udp connections. Further ikml logging (kernel) logging can be disabled, e.g. for lxc containers and logs can be redirected to an other server. | ||
|
||
.. note:: | ||
|
||
Contributions are welcome. | ||
|
||
Available states | ||
================ | ||
|
||
.. contents:: | ||
:local: | ||
|
||
``rsyslog`` | ||
------------ | ||
|
||
Install and configure the ``rsyslog`` package and enable the service. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
rsyslog: | ||
target: 192.168.100.1 # omit if you do not want to forward logs | ||
enabletcp: true # omit to disable listening on tcp port | ||
enableudp: true # omit to disable listening on udp port | ||
disableimkl: true # omit to log kernel messages |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# /etc/rsyslog.conf Configuration file for rsyslog. | ||
# | ||
# For more information see | ||
# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html | ||
|
||
|
||
################# | ||
#### MODULES #### | ||
################# | ||
|
||
$ModLoad imuxsock # provides support for local system logging | ||
{% if config.imkllog|default(true) %} | ||
$ModLoad imklog # provides kernel logging support (previously done by rklogd) | ||
{% endif %} | ||
#$ModLoad immark # provides --MARK-- message capability | ||
|
||
{% if config.listenudp|default(false) %} | ||
# provides UDP syslog reception | ||
$ModLoad imudp | ||
$UDPServerRun 514 | ||
{% endif %} | ||
|
||
{% if config.listentcp|default(false) %} | ||
# provides TCP syslog reception | ||
$ModLoad imtcp | ||
$InputTCPServerRun 514 | ||
{% endif %} | ||
|
||
########################### | ||
#### GLOBAL DIRECTIVES #### | ||
########################### | ||
|
||
# | ||
# Use traditional timestamp format. | ||
# To enable high precision timestamps, comment out the following line. | ||
# | ||
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat | ||
|
||
# | ||
# Set the default permissions for all log files. | ||
# | ||
$FileOwner root | ||
$FileGroup adm | ||
$FileCreateMode 0640 | ||
$DirCreateMode 0755 | ||
$Umask 0022 | ||
|
||
# | ||
# Include all config files in /etc/rsyslog.d/ | ||
# | ||
$IncludeConfig /etc/rsyslog.d/*.conf | ||
|
||
|
||
############### | ||
#### RULES #### | ||
############### | ||
|
||
# | ||
# First some standard log files. Log by facility. | ||
# | ||
auth,authpriv.* /var/log/auth.log | ||
*.*;auth,authpriv.none -/var/log/syslog | ||
#cron.* /var/log/cron.log | ||
daemon.* -/var/log/daemon.log | ||
kern.* -/var/log/kern.log | ||
lpr.* -/var/log/lpr.log | ||
mail.* -/var/log/mail.log | ||
user.* -/var/log/user.log | ||
|
||
# | ||
# Logging for the mail system. Split it up so that | ||
# it is easy to write scripts to parse these files. | ||
# | ||
mail.info -/var/log/mail.info | ||
mail.warn -/var/log/mail.warn | ||
mail.err /var/log/mail.err | ||
|
||
# | ||
# Logging for INN news system. | ||
# | ||
news.crit /var/log/news/news.crit | ||
news.err /var/log/news/news.err | ||
news.notice -/var/log/news/news.notice | ||
|
||
# | ||
# Some "catch-all" log files. | ||
# | ||
*.=debug;\ | ||
auth,authpriv.none;\ | ||
news.none;mail.none -/var/log/debug | ||
*.=info;*.=notice;*.=warn;\ | ||
auth,authpriv.none;\ | ||
cron,daemon.none;\ | ||
mail,news.none -/var/log/messages | ||
|
||
# | ||
# Emergencies are sent to everybody logged in. | ||
# | ||
*.emerg * | ||
|
||
# | ||
# I like to have messages displayed on the console, but only on a virtual | ||
# console I usually leave idle. | ||
# | ||
#daemon,mail.*;\ | ||
# news.=crit;news.=err;news.=notice;\ | ||
# *.=debug;*.=info;\ | ||
# *.=notice;*.=warn /dev/tty8 | ||
|
||
# The named pipe /dev/xconsole is for the `xconsole' utility. To use it, | ||
# you must invoke `xconsole' with the `-file' option: | ||
# | ||
# $ xconsole -file /dev/xconsole [...] | ||
# | ||
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably | ||
# busy site.. | ||
# | ||
daemon.*;mail.*;\ | ||
news.err;\ | ||
*.=debug;*.=info;\ | ||
*.=notice;*.=warn |/dev/xconsole | ||
|
||
{% if config.target|default(false) %} | ||
*.* @{{ config.target }} | ||
{% endif %} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{% from "rsyslog/map.jinja" import rsyslog with context %} | ||
package_{{ rsyslog.package }}: | ||
pkg: | ||
- name: {{ rsyslog.package }} | ||
- installed | ||
service_{{ rsyslog.service }}: | ||
service.running: | ||
- name: {{ rsyslog.service }} | ||
- enable: True | ||
- require: | ||
- pkg: package_{{ rsyslog.package }} | ||
- watch: | ||
- file: config_{{ rsyslog.config }} | ||
config_{{ rsyslog.config }}: | ||
file.managed: | ||
- name: /etc/rsyslog.conf | ||
- template: jinja | ||
- source: salt://rsyslog/files/rsyslog.conf.jinja | ||
- context: | ||
config: {{ salt['pillar.get']('rsyslog', {}) }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% set rsyslog = salt['grains.filter_by']({ | ||
'Debian': { | ||
'package': 'rsyslog', | ||
'service': 'rsyslog', | ||
'config': '/etc/rsyslog.conf' | ||
}, | ||
'RedHat': { | ||
'package': 'rsyslog', | ||
'service': 'rsyslog', | ||
}, | ||
}, merge=salt['pillar.get']('rsyslog:lookup')) %} |