message

package
v0.0.0-...-5655933 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusEmergency = "emergency"
	StatusAlert     = "alert"
	StatusCritical  = "critical"
	StatusError     = "error"
	StatusWarning   = "warn"
	StatusNotice    = "notice"
	StatusInfo      = "info"
	StatusDebug     = "debug"
)

Status values

Variables

View Source
var (
	SevEmergency = []byte("<40>")
	SevAlert     = []byte("<41>")
	SevCritical  = []byte("<42>")
	SevError     = []byte("<43>")
	SevWarning   = []byte("<44>")
	SevNotice    = []byte("<45>")
	SevInfo      = []byte("<46>")
	SevDebug     = []byte("<47>")
)

Syslog severity levels

Functions

func StatusToSeverity

func StatusToSeverity(status string) []byte

StatusToSeverity transforms a severity into a status.

Types

type Lambda

type Lambda struct {
	ARN       string
	RequestID string
}

Lambda is a struct storing information about the Lambda function and function execution.

type Message

type Message struct {
	Content []byte
	Origin  *Origin

	IngestionTimestamp int64
	// Optional. Must be UTC. If not provided, time.Now().UTC() will be used
	// Used in the Serverless Agent
	Timestamp time.Time
	// Optional.
	// Used in the Serverless Agent
	Lambda *Lambda
	// contains filtered or unexported fields
}

Message represents a log line sent to datadog, with its metadata

func NewMessage

func NewMessage(content []byte, origin *Origin, status string, ingestionTimestamp int64) *Message

NewMessage constructs message with content, status, origin and the ingestion timestamp.

func NewMessageFromLambda

func NewMessageFromLambda(content []byte, origin *Origin, status string, utcTime time.Time, ARN, reqID string, ingestionTimestamp int64) *Message

NewMessageFromLambda construts a message with content, status, origin and with the given timestamp and Lambda metadata

func NewMessageWithSource

func NewMessageWithSource(content []byte, status string, source *logsconfig.LogSource, ingestionTimestamp int64) *Message

NewMessageWithSource constructs message with content, status and log source.

func (*Message) GetHostname

func (m *Message) GetHostname() string

GetHostname returns the hostname to applied the given log message

func (*Message) GetLatency

func (m *Message) GetLatency() int64

GetLatency returns the latency delta from ingestion time until now

func (*Message) GetStatus

func (m *Message) GetStatus() string

GetStatus gets the status of the message. if status is not set, StatusInfo will be returned.

type Origin

type Origin struct {
	Identifier string
	LogSource  *logsconfig.LogSource
	Offset     string
	// contains filtered or unexported fields
}

Origin represents the Origin of a message

func NewOrigin

func NewOrigin(source *logsconfig.LogSource) *Origin

NewOrigin returns a new Origin

func (*Origin) Service

func (o *Origin) Service() string

Service returns the service of the configuration if set or the service of the message, if none are defined, returns an empty string by default.

func (*Origin) SetService

func (o *Origin) SetService(service string)

SetService sets the service of the origin.

func (*Origin) SetSource

func (o *Origin) SetSource(source string)

SetSource sets the source of the origin.

func (*Origin) SetTags

func (o *Origin) SetTags(tags []string)

SetTags sets the tags of the origin.

func (*Origin) Source

func (o *Origin) Source() string

Source returns the source of the configuration if set or the source of the message, if none are defined, returns an empty string by default.

func (*Origin) Tags

func (o *Origin) Tags() []string

Tags returns the tags of the origin.

func (*Origin) TagsPayload

func (o *Origin) TagsPayload() []byte

TagsPayload returns the raw tag payload of the origin.

func (*Origin) TagsToJsonString

func (o *Origin) TagsToJsonString() string

func (*Origin) TagsToString

func (o *Origin) TagsToString() string

TagsToString encodes tags to a single string, in a comma separated format

Jump to

Keyboard shortcuts

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