Skip to content

Commit

Permalink
Adding access_log.pp
Browse files Browse the repository at this point in the history
Removing from header.erb
  • Loading branch information
Shinobiscript authored Feb 2, 2024
1 parent 8e4516c commit 0b2ee9e
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions manifests/access_log.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# @summary
# Defines access_log entries for a squid server.
# @see
# http://www.squid-cache.org/Doc/config/access_log/
# @example
# squid::access_log: { 'myAccessLog' :
# module => 'syslog'
# entries => [
# 'place daemon'
# 'logformat squid'
# 'acl hasRequest'
# ],
# }
#
# Adds a squid.conf line:
# squid::access_log: syslog:daemon squid hasRequest
# @param module
# Location of access log
# @param entries
# Access log entry's preceding comment
# @param order
# Order can be used to configure where in `squid.conf`this configuration section should occur.
define squid::access_log (
Enum['none', 'stdio', 'daemon', 'syslog', 'udp', 'tcp'] $module,
Variant[String, Array[String]] $entries,
String $access_log_name = $title,
String $order = '50',
) {
$entries_array = $entries ? {
String => [$entries],
default => $entries,
}

$entries_array.each |$entry| {
concat::fragment { "squid_access_log_${access_log_name}_${entry}":
target => $squid::config,
content => epp('squid/squid.conf.access_log.epp', { 'module' => $module, 'entry' => $entry }),
order => "38-${order}-${module}",
}
}
}

0 comments on commit 0b2ee9e

Please sign in to comment.