csls

package
v0.0.0-...-122e78d Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParamMAC               = "mac"
	ParamServiceInstanceID = "instance_id"
)
View Source
const (
	SyslogLogGroup = "rfc5424_syslog"
	SyslogOwner    = "GOV.UK_PaaS"
	SyslogDataType = "DATA_MESSAGE"
)

Variables

View Source
var (
	ErrUnauthorizedAppGUID    = fmt.Errorf("unauthorized-log-attempt")
	ErrUnauthenticatedRequest = fmt.Errorf("unauthenticated-request")
	ErrBadRequestBody         = fmt.Errorf("failed-to-read-body")
	ErrBadRequestParams       = fmt.Errorf("invalid-request-arguments")
	ErrFailForwardStream      = fmt.Errorf("failed-to-forward-to-stream")
)
View Source
var (
	ErrInvalidMessageAuthArgs = errors.New("invalid arguments for mac generation")
)
View Source
var ErrUpdateNotSupported = errors.New("Updating a splunk service is currently not supported")

Functions

func GenerateMAC

func GenerateMAC(appGUID, serviceInstanceGUID uuid.UUID, key string) (string, error)

GenerateMAC generates a base64 encoded Message Authentication Code for a given application GUID

func NewSyslogDrainURL

func NewSyslogDrainURL(baseURL, appID, instanceID, secretKey string) (*url.URL, error)

func VerifyMAC

func VerifyMAC(appGUID, serviceInstanceGUID uuid.UUID, key, unverifiedMAC string) (bool, error)

VerifyMAC checks that a given Message Authentication Code is valid for a given application GUID

Types

type CloudfoundryLogPutter

type CloudfoundryLogPutter interface {
	PutCloudfoundryLog(log cloudfoundry.Log, logGroupName string) error
}

CloudfoundryLogPutter forwards cloudfoundry format Logs to stream

type Handler

type Handler struct {
	// Stream is the log destination
	Stream CloudfoundryLogPutter
	// Secret is the shared secret for authenticating log requests
	Secret string
}

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

HandleHTTP processes syslog over https from a standard go http.Server

type Log

type Log struct {
	Owner               string     `json:"owner"`
	LogGroup            string     `json:"logGroup"`
	LogStream           string     `json:"logStream"`
	SubscriptionFilters []string   `json:"subscriptionFilters"`
	MessageType         string     `json:"messageType"`
	LogEvents           []LogEvent `json:"logEvents"`
}

Log represents a collection of Log messages from the same source. It is a duplicate of the AWS Cloudwatch Log envelope.

type LogEvent

type LogEvent struct {
	ID        string `json:"id"`
	Timestamp int64  `json:"timestamp"`
	Message   string `json:"message"`
}

LogEvent represents a log message. It mirrors the format of the AWS Cloudwatch log event envelope

type SplunkProvider

type SplunkProvider struct {
	SyslogDrainURL string
	SecretKey      string
}

func NewSplunkProvider

func NewSplunkProvider(drainURL, secretKey string) (*SplunkProvider, error)

func (*SplunkProvider) Bind

func (s *SplunkProvider) Bind(ctx context.Context, bindData provideriface.BindData) (binding domain.Binding, err error)

func (*SplunkProvider) Deprovision

func (s *SplunkProvider) Deprovision(ctx context.Context, deprovisionData provideriface.DeprovisionData) (operationData string, isAsync bool, err error)

func (*SplunkProvider) LastOperation

func (s *SplunkProvider) LastOperation(ctx context.Context, lastOperationData provideriface.LastOperationData) (state domain.LastOperationState, description string, err error)

func (*SplunkProvider) Provision

func (s *SplunkProvider) Provision(ctx context.Context, provisionData provideriface.ProvisionData) (dashboardURL, operationData string, isAsync bool, err error)

func (*SplunkProvider) Unbind

func (*SplunkProvider) Update

func (s *SplunkProvider) Update(ctx context.Context, updateData provideriface.UpdateData) (
	operationData string, isAsync bool, err error)

type Stream

type Stream struct {
	// Name is the name of the kinesis stream to write to
	Name string
	// Client is the AWS SDK capable of PutRecord
	AWS sdk.Client
}

Stream represents the input to the csls logging pipeline

func (*Stream) PutCloudfoundryLog

func (w *Stream) PutCloudfoundryLog(log cloudfoundry.Log, groupName string) error

PutCloudfoundryLog transforms cloudfoundry format logs into csls format (cloudwatch format) logs and writes them to the csls kinesis stream with a given log group name

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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