X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;ds=sidebyside;f=templates%2Fsyslog-ng.conf.erb;fp=templates%2Fsyslog-ng.conf.erb;h=abe8fe5b1524fe01262264830427175d8a2b83f0;hb=58403c9e36e656b9e17ac1f43f93b280316a3e98;hp=ac214c252365cc1ffdfcb8355ffe2dec9a205961;hpb=f8063eba588ec4430e669860035d4f079b1dc0cf;p=mirror%2Fdsa-puppet.git diff --git a/templates/syslog-ng.conf.erb b/templates/syslog-ng.conf.erb index ac214c252..abe8fe5b1 100644 --- a/templates/syslog-ng.conf.erb +++ b/templates/syslog-ng.conf.erb @@ -94,7 +94,7 @@ options { # sources # all known message sources -source s_all { +source a_local { # message generated by Syslog-NG internal(); <%- if kernel == 'Linux' -%> @@ -237,29 +237,28 @@ filter f_xconsole { }; <%- end -%> -###### -# logs + # order matters if you use "flags(final);" to mark the end of processing in a # "log" statement -# these rules provide the same behavior as the commented original syslogd rules +############################################################################### +########## ON LOG CLIENTS ##################################################### +############################################################################### +############################################################################### +############################################################################### +# all log clients, including the log server, log their locally created +# messages to the standard places. # auth,authpriv.* /var/log/auth.log log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_auth); destination(df_auth); }; # *.*;auth,authpriv.none -/var/log/syslog log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_syslog); destination(df_syslog); }; @@ -267,77 +266,56 @@ log { # this is commented out in the default syslog.conf # cron.* /var/log/cron.log #log { -# source(s_all); +# source(a_local); # filter(f_cron); # destination(df_cron); #}; # daemon.* -/var/log/daemon.log log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_daemon); destination(df_daemon); }; # kern.* -/var/log/kern.log log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_kern); destination(df_kern); }; # lpr.* -/var/log/lpr.log log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_lpr); destination(df_lpr); }; # mail.* -/var/log/mail.log log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_mail); destination(df_mail); }; # user.* -/var/log/user.log log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_user); destination(df_user); }; # uucp.* /var/log/uucp.log log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_uucp); destination(df_uucp); }; # mail.info -/var/log/mail.info log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_mail); filter(f_at_least_info); destination(df_mail_info); @@ -345,10 +323,7 @@ log { # mail.warn -/var/log/mail.warn log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_mail); filter(f_at_least_warn); destination(df_mail_warn); @@ -356,10 +331,7 @@ log { # mail.err /var/log/mail.err log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_mail); filter(f_at_least_err); destination(df_mail_err); @@ -367,10 +339,7 @@ log { # news.crit /var/log/news/news.crit log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_news); filter(f_at_least_crit); destination(df_news_dot_crit); @@ -378,10 +347,7 @@ log { # news.err /var/log/news/news.err log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_news); filter(f_at_least_err); destination(df_news_dot_err); @@ -389,10 +355,7 @@ log { # news.notice /var/log/news/news.notice log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_news); filter(f_at_least_notice); destination(df_news_dot_notice); @@ -403,10 +366,7 @@ log { # auth,authpriv.none;\ # news.none;mail.none -/var/log/debug log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_debug); destination(df_debug); }; @@ -417,20 +377,14 @@ log { # cron,daemon.none;\ # mail,news.none -/var/log/messages log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_messages); destination(df_messages); }; # *.emerg * log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_emerg); destination(du_all); }; @@ -442,15 +396,13 @@ log { # *.=debug;*.=info;\ # *.=notice;*.=warn |/dev/xconsole log { - source(s_all); -<%- if hostname == "heininen" -%> - source(s_network); -<%- end -%> + source(a_local); filter(f_xconsole); destination(dp_xconsole); }; <%- end -%> + <%- if hostname != "heininen" -%> <%- if syslogversion == "3" -%> destination loghost-heininen { @@ -464,8 +416,119 @@ destination loghost-heininen { log { - source(s_all); + source(a_local); destination(loghost-heininen); }; <%- end -%> <%- end -%> + + + +<%- if hostname == "heininen" -%> +############################################################################### +########## ON LOG HOST ######################################################## +############################################################################### +############################################################################### +# +# The log server, additionally, also logs all local and remote messages to +# a few special places. +destination hostdest_auth { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/auth.log" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_syslog { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/syslog" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_cron { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/cron.log" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_daemon { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/daemon.log" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_kern { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/kern.log" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_lpr { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/lpr.log" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_mail { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/mail.log" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_news { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/news.log" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_user { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/user.log" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_uucp { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/uucp.log" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_debug { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/debug" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_messages { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/messages" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; + + +#---------------------------------------------------------------------- +# Special catch all destination hostdest_sorting by host +#---------------------------------------------------------------------- +destination hostdest_facility_dot_info { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.info" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_facility_dot_notice { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.notice" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_facility_dot_warn { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.warn" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_facility_dot_err { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.err" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; +destination hostdest_facility_dot_crit { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.crit" + owner(root) group(adm) perm(0640) dir_perm(0750) create_dirs(yes) dir_owner(root) dir_group(adm)); }; + + +#---------------------------------------------------------------------- +# Catch all log files +#---------------------------------------------------------------------- +destination df_ALL_auth { file("/var/log/auth-all.log"); }; +destination df_ALL_syslog { file("/var/log/syslog-all"); }; + +log { source(s_local); + source(s_network); + filter(f_auth); destination(hostdest_auth); }; +log { source(s_local); + source(s_network); + filter(f_syslog); destination(hostdest_syslog); }; +log { source(s_local); + source(s_network); + filter(f_daemon); destination(hostdest_daemon); }; +log { source(s_local); + source(s_network); + filter(f_kern); destination(hostdest_kern); }; +log { source(s_local); + source(s_network); + filter(f_lpr); destination(hostdest_lpr); }; +log { source(s_local); + source(s_network); + filter(f_mail); destination(hostdest_mail); }; +log { source(s_local); + source(s_network); + filter(f_news); destination(hostdest_mail); }; +log { source(s_local); + source(s_network); + filter(f_user); destination(hostdest_user); }; +log { source(s_local); + source(s_network); + filter(f_uucp); destination(hostdest_uucp); }; +log { source(s_local); + source(s_network); + filter(f_debug); destination(hostdest_debug); }; +log { source(s_local); + source(s_network); + filter(f_messages); destination(hostdest_messages); }; + +log { source(s_local); + source(s_network); + filter(f_mail); filter(f_at_least_info); destination(hostdest_facility_dot_info); }; +log { source(s_local); + source(s_network); + filter(f_mail); filter(f_at_least_warn); destination(hostdest_facility_dot_warn); }; +log { source(s_local); + source(s_network); + filter(f_mail); filter(f_at_least_err); destination(hostdest_facility_dot_err); }; + + +## catch all: +log { source(s_local); + source(s_network); + filter(f_auth); destination(df_ALL_auth); }; +log { source(s_local); + source(s_network); + filter(f_syslog); destination(df_ALL_syslog); }; +<%- end -%>