Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

spartan_loggly_rsyslog (6) Versions 3.1.1

Configures rsyslog to send logs to Loggly

Policyfile
Berkshelf
Knife
cookbook 'spartan_loggly_rsyslog', '~> 3.1.1', :supermarket
cookbook 'spartan_loggly_rsyslog', '~> 3.1.1'
knife supermarket install spartan_loggly_rsyslog
knife supermarket download spartan_loggly_rsyslog
README
Dependencies
Changelog
Quality 33%

Loggly rsyslog Cookbook

Circle CI

Note: This has been forked from apetresc/loggly-rsyslog.

Installs and configures rsyslog for use with Loggly.

Supported Versions

  • Chef 12
  • Ruby 2.1.6
  • Ruby 2.2.4
  • rsyslog 5.8 through 8.4

Platform

Tested against Ubuntu 12.04, 14.04, 15.04, 16.04
Tested against Centos 6.6, 6.7, 6.8, 7.2.
Tested against Debian 7.11

Attributes

This cookbook leverages the
rsyslog to install rsyslog. You
can use any of it's attributes to configure rsyslog further than what this
cookbook exposes.

normal['rsyslog']['max_message_size'] (default: '64k')

This cookbook sets the max message size to 64k per Loggly's recommendation.

default['loggly']['tags'] (default: [])

Expects an array of strings that will all be set as global tags for the system.

default['loggly']['log_files'] (default: [])

Set up rsyslog to watch files and send contents off to loggly.

Expects an array of Hashes with the following keys:

  • filename (required)
    • an absolute path to the file
  • tag (optional)
    • a tag to attach to content from the file
    • Default: basename of filename with periods replaced with dashes (e.g. /d/f.log -> f-log)
  • statefile (optional)
    • an absolute path to the rsyslog statefile
    • Default: the filename path with .rsyslog_state appended (e.g. /d/f.log -> /d/f.log.rsyslog_state)
  • severity (optional)
    • the rsyslog severity for the contents of the file
    • Default: the severity will be omitted from the config if it isn't set. Rsyslog will default it to Info

Example:

  node.default['loggly']['log_files'] = [
    { 'filename' => '/string/key.file.ext' },
    { filename: '/just/a/file.log' },
    { filename: '/every/thing.txt', tag: 'all the options', statefile: '/tmp/state', severity: 'Warning' }
  ]

default['loggly']['apps'] (default: {})

Set up rsyslog to watch a group of related files, and dispatch contents to loggly with a common tag.

This can be used to implement the pattern shown in the loggly docs for apache and nginx.

Expects a hash.

Each key is used in naming the config file, and also set the common tag sent to loggly.

The values should be an array of files in the format used by default['loggly']['log_files'].

In addition to the common application-level tag, each file will have a file-specific tag, which allows differentiating within loggly.

This example will generate a file /etc/rsyslog.d/21-nginx.conf with contents similar to the nginx manual configuration example:

node.default['loggly']['apps'] = {
'nginx' => [ { 'filename' => '/var/log/nginx/access.log',
'statefile' => 'stat-nginx-access',
'tag' => 'nginx-access'
'severity' => 'info'},
{ 'filename' => '/var/log/nginx/error.log'
'statefile' => 'stat-nginx-error',
'tag' => 'nginx-error',
'severity' => 'error' }
]
}

default['loggly']['tls']['cert_path'] (default: '/etc/rsyslog.d/keys/ca.d')

The path to save the loggly cert.

default['loggly']['tls']['cert_file'] (default: 'logs-01.loggly.com_sha12.crt')

The filename for the loggly cert.

default['loggly']['tls']['cert_url'] (default: 'https://logdog.loggly.com/media/logs-01.loggly.com_sha12.crt')

The url from which to fetch the loggly cert.

default['loggly']['tls']['cert_checksum'] (default: 'b562ae82b54bcb43923290e78949153c0c64910d40b02d2207010bb119147ffc')

The SHA256 checksum of the cert.

default['loggly']['token'] (default: '')

The loggly token. It is best to wrap this cookbook with another cookbook that
gets this secret from a databag or some other secret storage system.

default['loggly']['rsyslog']['conf_dir'] (default: '/etc/rsyslog.d')

The rsyslog configuration directory.

default['loggly']['rsyslog']['conf'] (default: "#{node['loggly']['rsyslog']['conf_dir']}/22-loggly.conf")

The filename for the loggly rsyslog configuration file.

default['loggly']['rsyslog']['files_conf'] (default: "#{node['loggly']['rsyslog']['conf_dir']}/99-files.conf")

The filename for the rsyslog configuration file that will setup rsyslog to watch files for sending to loggly.

default['loggly']['rsyslog']['host'] (default: 'logs-01.loggly.com')

The host for rsyslog to send logs.

default['loggly']['rsyslog']['port'] (default: 6514)

The port for rsyslog to send logs.

default['loggly']['rsyslog']['input_file_poll_interval'] (default: 10)

How often rsyslog will check files for new content to send to loggly.

Recipes

Include the default recipe in a cookbook. The cookbook includes the rsyslog
cookbook that will install the rsyslog package and start the service if it does
not exist. The rsyslog service will restart after changes to the loggly rsyslog
or input files configuration file(s) are made.

Running Tests

  • Ensure that you have the chefdk installed.
  • Run: rake

You can see the individual rake commands with rake -T

License & Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

rsyslog ~> 4.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Change Log

All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.

Unreleased

3.1.1 - 2016-10-06

Fixed

  • Deprecation warnings from using method attribute accessors.

3.1.0 - 2016-09-27

Added

  • Support for nginx apps
  • Support for centos-6.8, centos-7.2, ubuntu-16.04
  • Support for rsyslog 6

3.0.0 - 2016-04-21

Removed

  • Data Bag support.
  • Ability to "watch" directories.
  • Option to disable TLS.

Updated

  • Loggly rsyslog config to use rsyslog 7 syntax.
  • Moved file definitions to their own config file.

2.1.3 - 2016-03-03

Fixed

  • cert checksum value to the latest.

2.1.2 - 2016-03-03

Added

  • .editorconfig file.

Fixed

  • refactoring name to spartan_loggly_rsyslog.

2.1.1 - 2016-03-03

  • Update fork of cookbook to be managed by Spartan.

2.0.0

  • Use an encrypted databag to retrieve the loggly token instead of a node attribute

1.0.1

  • Set rsyslog configuration values to be configurable via attributes

1.0.0 (1/25/2014)

  • Initial cookbook version
  • Support for sending messages using TLS
  • Configuration for monitoring a list of files
  • Configuration for monitoring a list of directories

Collaborator Number Metric
            

3.1.1 failed this metric

Failure: Cookbook has 1 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

3.1.1 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

3.1.1 passed this metric

No Binaries Metric
            

3.1.1 passed this metric

Testing File Metric
            

3.1.1 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

3.1.1 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number