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

Added tag support to rsyslog #23

Open
wants to merge 1 commit into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -160,6 +160,23 @@ node 'my_server_node.example.net' {
```
TLS enabled by default in the Loggly rsyslog module, so data sent from your systems to Loggly is encrypted and safe from unwanted eavesdropping.

Optionally you can also add tags to your setup using the tags argument:
For example:
```puppet
node 'my_server_node.example.net' {
# Send syslog events to Loggly
class { 'loggly::rsyslog':
customer_token => 'de7b5ccd-04de-4dc4-fbc9-501393600000',
tags => [
'application-server',
'production',
'ny2',
]
}
}
```


#### If you use the syslog-ng daemon
syslog-ng is not installed by default on Red Hat-style distributions, so ensure that the syslog-ng package is installed (a perfect job for Puppet!) before including the Loggly syslog-ng module. You will need your Customer Token you obtained from the Finding your Customer Token section of this guide.

@@ -18,7 +18,7 @@
# Enables or disables TLS encryption for shipped log events.
#
# [*cert_path*]
# Directory to store the Loggly TLS certs in. Normally this would be
# Directory to store the Loggly TLS certs in. Normally this would be
# relative to $base_dir.
#
# === Authors
@@ -30,13 +30,15 @@
$base_dir = $loggly::params::base_dir,
$enable_tls = $loggly::params::enable_tls,
$cert_path = undef,
$tags = $loggly::params::tags,
) inherits loggly::params {

$_cert_path = pick($cert_path, "${base_dir}/certs")

validate_absolute_path($base_dir)
validate_absolute_path($_cert_path)
validate_bool($enable_tls)
validate_array($tags)

# create directory for loggly support files
file { $base_dir:
@@ -23,6 +23,8 @@
fail("$operatingsystem not supported")
}
}

$tags = []
}

# vim: syntax=puppet ft=puppet ts=2 sw=2 nowrap et
@@ -38,11 +38,13 @@
$customer_token,
$cert_path = $loggly::_cert_path,
$enable_tls = $loggly::enable_tls,
$tags = $loggly::tags,
) inherits loggly {

validate_string($customer_token)
validate_absolute_path($cert_path)
validate_bool($enable_tls)
validate_array($tags)

# Emit a configuration snippet that submits events to Loggly by default
file { '/etc/rsyslog.d/22-loggly.conf':
@@ -4,7 +4,7 @@
### TLS RsyslogTemplate for Loggly
##########################################################

$template LogglyFormat,"<%%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [<%= @customer_token -%>@41058 tag=\"Rsyslog TLS\"] %msg%"
$template LogglyFormat,"<%%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [<%= @customer_token -%>@41058 <% @tags.each do |value| -%>tag=\"<%=value%>\" <% end -%>] %msg%"

#RsyslogGnuTLS

@@ -22,7 +22,7 @@ $ActionSendStreamDriverPermittedPeer *.loggly.com
### TLS RsyslogTemplate for Loggly
##########################################################

$template LogglyFormat,"<%%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [<%= @customer_token -%>@41058] %msg%\n"
$template LogglyFormat,"<%%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [<%= @customer_token -%>@41058 <% @tags.each do |value| -%>tag=\"<%=value%>\" <% end -%>] %msg%\n"

*.* @@logs-01.loggly.com:514; LogglyFormat
<% end -%>
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.