lambda

package
v0.0.0-...-5163fa9 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlattenMessage

func FlattenMessage(source *map[string]string, message string)

FlattenMessage will JSON parse message and append nested fields as top level keys in source

func HandleRequest

func HandleRequest(event Event) (string, error)

HandleRequest is main function for handling requests @params event: the lambda event received @returns: (status of request, error)

func TestElasticsearchConnectivty

func TestElasticsearchConnectivty(esHost, region string) (string, error)

TestElasticsearchConnectivty tests connectivity to ES @params: (esHost, region string) @returns: (status string, error)

Types

type AwsLog

type AwsLog struct {
	CompressedInput string
	Data            AwsLogData
	ESBulkPayload   string
	// contains filtered or unexported fields
}

AwsLog is a class to receive data from lambda and send it to ES

func NewAwsLog

func NewAwsLog(i *NewAwsLogInput) (*AwsLog, error)

NewAwsLog is the constructor for AwsLog @params: i *NewAwsLogInput - new aws log input struct @returns: (new *AwsLog struct, error)

func (*AwsLog) BulkUpdateES

func (l *AwsLog) BulkUpdateES() (string, error)

BulkUpdateES will send a bulk update payload to ES through a signed request @returns: (bulk update status, error)

func (*AwsLog) SignedBulkUpdateRequest

func (l *AwsLog) SignedBulkUpdateRequest() *http.Request

SignedBulkUpdateRequest will create a signed bulk update request @returns: aws signed request based on payload

type AwsLogData

type AwsLogData struct {
	MessageType string     `json:"messageType"`
	LogGroup    string     `json:"logGroup"`
	LogStream   string     `json:"logStream"`
	LogEvents   []LogEvent `json:"logEvents"`
}

AwsLogData is the model cloudwatch sends over to lambda

type ESUpdateResultItem

type ESUpdateResultItem struct {
	Status int `json:"status"`
}

ESUpdateResultItem is the model for es bulk update response

type ESUpdateResults

type ESUpdateResults struct {
	Items []ESUpdateResultItem `json:"items"`
}

ESUpdateResults is the model for es bulk update response

type Event

type Event struct {
	AwsLogs struct {
		Data string `json:"data"`
	} `json:"awslogs"`
}

Event model for lambda input event

type LogEvent

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

LogEvent is the model for log events

type NewAwsLogInput

type NewAwsLogInput struct {
	// contains filtered or unexported fields
}

NewAwsLogInput is the struct for creating a new AwsLog struct

Jump to

Keyboard shortcuts

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