Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify a different timestamp format (ActionFileDefaultTemplate) #100

Open
gothicx opened this issue Apr 26, 2016 · 1 comment
Open

Comments

@gothicx
Copy link
Contributor

gothicx commented Apr 26, 2016

This has been supported in the saz/rsyslog.

rsyslog::client::actionfiletemplate: 'PEPrecise'
rsyslog::client::log_templates:

  • name: 'PEPrecise'
    template: '%timegenerated% %HOSTNAME% %syslogfacility-text%.%syslogpriority-text% %syslogtag% %msg%\n'
@gothicx
Copy link
Contributor Author

gothicx commented Apr 26, 2016

diff -ruNb ../../LAN/modules/rsyslog/manifests/init.pp rsyslog/manifests/init.pp
--- ../../LAN/modules/rsyslog/manifests/init.pp 2016-02-04 19:51:15.000000000 +0100
+++ rsyslog/manifests/init.pp   2016-04-26 13:30:09.407006379 +0200
@@ -39,6 +39,8 @@
   $remote_template          = '%HOSTNAME%/%$YEAR%-%$MONTH%-%$DAY%.log',
   $remote_logging           = false,
   $rsyslog_conf_version     = 'USE_DEFAULTS',
+  $log_templates            = false,
+  $actionfiletemplate       = false,
   $rsyslog_d_dir            = '/etc/rsyslog.d',
   $rsyslog_d_dir_owner      = 'root',
   $rsyslog_d_dir_group      = 'root',
diff -ruNb ../../LAN/modules/rsyslog/templates/rsyslog.conf.erb rsyslog/templates/rsyslog.conf.erb
--- ../../LAN/modules/rsyslog/templates/rsyslog.conf.erb        2016-01-17 20:38:12.000000000 +0100
+++ rsyslog/templates/rsyslog.conf.erb  2016-04-26 13:36:57.722800135 +0200
@@ -37,12 +37,33 @@
 $WorkDirectory <%= @work_directory %>
 <% end -%>

+<% if @log_templates and ! @log_templates.empty? -%>
+
+# Define custom logging templates
+<% @log_templates.flatten.compact.each do |log_template| -%>
+$template <%= log_template['name'] %>,"<%= log_template['template'] %>"
+<% end -%>
+<% end -%>
+<% if @actionfiletemplate -%>
+
+# Using specified format for default logging format:
+$ActionFileDefaultTemplate <%= @actionfiletemplate %>
+<% else -%>
 # Use default timestamp format
 <% if @rsyslog_conf_version_real == 2 -%>
 $template TraditionalFormat,"%timegenerated% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%0"
 <% else -%>
 $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

+<% end -%>
+<% end -%>
+
+# Use default timestamp format
+#<% if @rsyslog_conf_version_real == 2 -%>
+#$template TraditionalFormat,"%timegenerated% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%0"
+#<% else -%>
+#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
+
 # File syncing capability is disabled by default. This feature is usually not required,
 # not useful and an extreme performance hit
 #$ActionFileEnableSync on

gothicx added a commit to gothicx/puppet-module-rsyslog that referenced this issue Apr 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant