Documentation
¶
Index ¶
- func FlattenMessage(source *map[string]string, message string)
- func HandleRequest(event Event) (string, error)
- func TestElasticsearchConnectivty(esHost, region string) (string, error)
- type AwsLog
- type AwsLogData
- type ESUpdateResultItem
- type ESUpdateResults
- type Event
- type LogEvent
- type NewAwsLogInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FlattenMessage ¶
FlattenMessage will JSON parse message and append nested fields as top level keys in source
func HandleRequest ¶
HandleRequest is main function for handling requests @params event: the lambda event received @returns: (status of request, error)
func TestElasticsearchConnectivty ¶
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 ¶
BulkUpdateES will send a bulk update payload to ES through a signed request @returns: (bulk update status, error)
func (*AwsLog) SignedBulkUpdateRequest ¶
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