papertrailforwarder

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2018 License: MIT Imports: 7 Imported by: 0

README

papertrailforwarder

Build Status godoc

Forward CloudWatch logs to Papertrail

Installation:

Install the library:

go get github.com/m90/papertrailforwarder

Usage:

Package papertrailforwarder allows for easy creation of AWS Lambda handlers that forward CloudWatch Log Events to Papertrail.

This is an example of an entire Lambda function:

package main

import (
	"github.com/aws/aws-lambda-go/lambda"
	"github.com/m90/papertrailforwarder"
)

func main() {
	handler, err := papertrailforwarder.New(
		papertrailforwarder.WithPapertrailHost(<HOST_VALUE>),
		papertrailforwarder.WithPapertrailPort(<PORT_VALUE>),
	)
	if err != nil {
		panic(err)
	}
	lambda.Start(handler)
}

Refer to the packages godoc for the entire documentation.

License

MIT © Frederik Ring

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(options ...Option) (func(context.Context, events.CloudwatchLogsEvent) error, error)

New creates a new AWS Lambda handler that forwards the passed CloudWatch Logs Event to Papertrail using the given configuration options. By default it will use the values set in the environment variables `PAPERTRAIL_HOST` and `PAPERTRAIL_PORT`

Types

type MessageTransform

type MessageTransform func(string, events.CloudwatchLogsLogEvent) (string, bool)

MessageTransform is a function that is used for applying conditional transforms to log messages. The first argument passed is the raw log message, the second one is the entire event. It can return false as its second return value to signal that the event should be skipped and not be forwarded to Papertrail.

type Option

type Option func(configuration) configuration

Option is a function that transforms the default configuration

func WithMessageTransform

func WithMessageTransform(transform MessageTransform) Option

WithMessageTransform defines a transform that will be applied to the log message

func WithPapertrailHost

func WithPapertrailHost(host string) Option

WithPapertrailHost sets the host of the Papertrail log target

func WithPapertrailPort

func WithPapertrailPort(port int) Option

WithPapertrailPort sets the port value for the Papertrail log target

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL