diff --git a/manifests/filter/container.pp b/manifests/filter/container.pp
index 26f581d..a0eb267 100644
--- a/manifests/filter/container.pp
+++ b/manifests/filter/container.pp
@@ -92,6 +92,11 @@
# String. The max file size for the log4j RollingFileAppender.
# Defaults to 100MB
#
+# [*log_local_compress*]
+# String. Whether to compress the rotated log or not.
+# Can be one of none,gz,zip
+# Defaults to none
+#
# [*log_local_rotation_count*]
# Integer. The number of backup files to keeo for the log4j RollingFileAppender
# Defaults to 4
@@ -313,6 +318,7 @@
$log_level = $repose::params::log_level,
$log_local_policy = $repose::params::log_local_policy,
$log_local_size = $repose::params::log_local_size,
+ $log_local_compress = $repose::params::log_local_compress,
$log_local_rotation_count = $repose::params::log_local_rotation_count,
$log_repose_facility = $repose::params::log_repose_facility,
$log_file_perm = $repose::params::log_file_perm,
@@ -359,6 +365,16 @@
validate_array($ssl_exclude_cipher)
}
+## log_local_compress_ext
+ if ! ($log_local_compress in [ 'none', 'gz', 'zip' ]) {
+ fail("\"${log_local_compress}\" is not a valid log_local_compress parameter value")
+ } else {
+ $log_local_compress_ext = $log_local_compress ? {
+ 'none' => '',
+ 'gz' => '.gz',
+ 'zip' => '.zip',
+ }
+
## ensure
if ! ($ensure in [ present, absent ]) {
fail("\"${ensure}\" is not a valid ensure parameter value")
diff --git a/manifests/params.pp b/manifests/params.pp
index aaddb09..f5bfb0e 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -196,6 +196,9 @@
## default local log rotation count
$log_local_rotation_count = 4
+## default log local compress is 'none'
+ $log_local_compress = 'none'
+
## default repose.log syslog facility
$log_repose_facility = 'local0'
diff --git a/templates/log4j2.xml.erb b/templates/log4j2.xml.erb
index 12a0003..674ba74 100644
--- a/templates/log4j2.xml.erb
+++ b/templates/log4j2.xml.erb
@@ -15,7 +15,7 @@
<%- if @log_local_policy == 'date' -%>
+ filePattern="<%= @log_dir-%>/<%= @app_name -%>.log.%d{yyyy-MM-dd}<%= @log_local_compress_ext -%>">
%d{yyyy-MM-dd HH:mm:ss} %-4r [%t] %-5p %c %x - %m%n
@@ -26,7 +26,7 @@
<%- elsif @log_local_policy == 'size' -%>
<%- if @log_file_perm == 'public' -%>
filePermissions="rw-r--r--"
<%- end -%>
@@ -86,7 +86,7 @@
<%- if @log_local_policy == 'date' -%>
+ filePattern="<%= @log_dir-%>/<%= @log_access_local_name -%>.log.%d{yyyy-MM-dd}<%= @log_local_compress_ext -%>">
%m%n
@@ -97,11 +97,12 @@
<%- elsif @log_local_policy == 'size' -%>
<%- if @log_file_perm == 'public' -%>
filePermissions="rw-r--r--"
<%- end -%>
>
+
%m%n