putdotio / salt-papertrail

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Papertrail Formula

This formula configures the Papertrail remote_syslog2 agent. To configure rsyslog for use with Papertrail, check out the Papertrail documentation.

Supported Platforms

  • RHEL 6 / CentOS 6
  • RHEL 7 / CentOS 7
  • Amazon Linux 2017.03
  • Ubuntu 14.04
  • Ubuntu 16.04
  • Debian 9

Usage

Quickstart

  1. Set the pillar attributes papertrail.destination_host, papertrail.destination_port, and at least one file/directory in files.
papertrail:
  files:
    - /var/log/syslog
    - /var/log/apache2/*.log
  destination_host: logsN.papertrailapp.com
  destination_port: XXXXX
  1. Include papertrail in your state file or top.sls, depending on which ever you prefer.

In a state:

include:
  - papertrail

in top.sls:

base:
  '*':
    - papertrail

This will install remote_syslog2 with the configured settings from Pillar.

Pillar attributes

This Salt formula only has one state, which does all setup and configuration. There are a number of Pillar items you can configure, all of which mirror the configuration items found in the remote_syslog2 README.

  • files

    A list of files or patterns to send to Papertrail.

    Example:

    papertrail:
      files:
        - /tmp/test.log
        - /srv/foo.txt
        - /var/log/*.bar
        - path: /srv/foo.txt
          tag: foo_file
  • exclude_files

    A list of files or patterns to exclude.

    Example:

    papertrail:
      exclude_files:
        - /tmp/exlude.log
        - /srv/dont-include.log
        - /var/log/skip-me.log
  • exclude_patterns:

    A regex of log message patterns to exclude.

    Example:

    papertrail:
      exclude_patterns:
        - \d+ things
  • hostname

    Override the default hostname.

    Example:

    papertrail:
      hostname: my-super-awesome-hostname
  • destination_host, destination_port, & destination_protocol

    The Papertrail host and port to send logs to, and the protocol to use. These are required. Protocol defaults to tls.

    Example:

    papertrail:
      destination_host: logsN.papertrailapp.com
      destination_port: XXXXX
      destination_protocol: tls
  • new_file_check_interval

    Overrides the default file check interval.

    Example:

    papertrail:
      new_file_check_interval: 30
  • severity

    Overrides the default remote_syslog2 severity level.

    Example:

    papertrail:
      severity: warn
  • facility

    Overrides the default remote_syslog2 facility.

    Example:

    papertrail:
      facility: local7
  • version

    Use a different version of remote_syslog than the default. The default is specified in map.jinja.

    Example:

    papertrail:
      version: 0.18

Testing

Unit tests

No unit tests exist at this time.

Integration tests

  1. Run kitchen test
  2. Take a break--it takes a bit to run the full suite.

The pillar test data is located in test-pillar.yaml.

Testing Amazon Linux

Testing Amazon Linux through test-kitchen requires a bit more setup:

  1. Ensure kitchen-ec2 is installed: chef gem install kitchen-ec2
  2. Update .kitchen.yml to have the correct AWS key ID you're going to use
  3. Set security_group_ids in the driver section to include a security group accessible from your laptop. Not setting this will use the default security group.
  4. Set transport.ssh_key to the path of your SSH key. It looks for id_rsa by default.

License and Authors

License: See LICENSE

Author: Mike Julian (@mjulian)

About

License:MIT License


Languages

Language:SaltStack 44.4%Language:HTML 31.2%Language:Ruby 24.4%