http

package
v0.0.0-...-0e0eee1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogDrainProjectQueryParam = "project"
	LogDrainServiceQueryParam = "service"
	LogDrainProjectHeader     = "x-highlight-project"
	LogDrainServiceHeader     = "x-highlight-service"
)

Variables

This section is empty.

Functions

func GetBody

func GetBody(ctx context.Context, r *http.Request) ([]byte, error)

func HandleFirehoseLog

func HandleFirehoseLog(w http.ResponseWriter, r *http.Request)

func HandleJSONLog

func HandleJSONLog(w http.ResponseWriter, r *http.Request)

func HandlePinoLogs

func HandlePinoLogs(w http.ResponseWriter, r *http.Request, lgJson []byte, logs *hlog.PinoLogs)

func HandleRawLog

func HandleRawLog(w http.ResponseWriter, r *http.Request)

func Listen

func Listen(r *chi.Mux, t trace.Tracer)

Types

type CloudFrontJsonPayload

type CloudFrontJsonPayload struct {
	Date        string `json:"date"`
	Time        string `json:"time"`
	Timestamp   string `json:"timestamp"`
	TimestampMs string `json:"timestamp(ms)"`
	ScStatus    string `json:"sc-status"`
	CsMethod    string `json:"cs-method"`
	CsHost      string `json:"cs(Host)"`
	CsUriStem   string `json:"cs-uri-stem"`
	CsUriQuery  string `json:"cs-uri-query"`
}

func (*CloudFrontJsonPayload) GetLevel

func (p *CloudFrontJsonPayload) GetLevel() string

func (*CloudFrontJsonPayload) GetMessage

func (p *CloudFrontJsonPayload) GetMessage() string

func (*CloudFrontJsonPayload) GetMessages

func (p *CloudFrontJsonPayload) GetMessages() []PayloadMessage

func (*CloudFrontJsonPayload) GetTimestamp

func (p *CloudFrontJsonPayload) GetTimestamp() *time.Time

func (*CloudFrontJsonPayload) Parse

func (p *CloudFrontJsonPayload) Parse(msg []byte) bool

func (*CloudFrontJsonPayload) SetLogAttributes

func (p *CloudFrontJsonPayload) SetLogAttributes(ctx context.Context, hl *hlog.Log, msg []byte) context.Context

type CloudWatchPayload

type CloudWatchPayload struct {
	MessageType         string
	Owner               string
	LogGroup            string
	LogStream           string
	SubscriptionFilters []string
	LogEvents           []CloudWatchPayloadMessage
}

func (*CloudWatchPayload) GetMessages

func (p *CloudWatchPayload) GetMessages() []PayloadMessage

func (*CloudWatchPayload) Parse

func (p *CloudWatchPayload) Parse(msg []byte) bool

type CloudWatchPayloadMessage

type CloudWatchPayloadMessage struct {
	Payload   *CloudWatchPayload `json:",omitempty"`
	Id        string
	Timestamp int64
	Message   string
}

func (*CloudWatchPayloadMessage) GetLevel

func (p *CloudWatchPayloadMessage) GetLevel() string

func (*CloudWatchPayloadMessage) GetMessage

func (p *CloudWatchPayloadMessage) GetMessage() string

func (*CloudWatchPayloadMessage) GetTimestamp

func (p *CloudWatchPayloadMessage) GetTimestamp() *time.Time

func (*CloudWatchPayloadMessage) SetLogAttributes

func (p *CloudWatchPayloadMessage) SetLogAttributes(ctx context.Context, hl *hlog.Log, msg []byte) context.Context

type FireLensFluentBitPayload

type FireLensFluentBitPayload struct {
	Message   string
	Level     string
	Source    string
	Timestamp string `json:"@timestamp"`
}

func (*FireLensFluentBitPayload) GetLevel

func (p *FireLensFluentBitPayload) GetLevel() string

func (*FireLensFluentBitPayload) GetMessage

func (p *FireLensFluentBitPayload) GetMessage() string

func (*FireLensFluentBitPayload) GetMessages

func (p *FireLensFluentBitPayload) GetMessages() []PayloadMessage

func (*FireLensFluentBitPayload) GetTimestamp

func (p *FireLensFluentBitPayload) GetTimestamp() *time.Time

func (*FireLensFluentBitPayload) Parse

func (p *FireLensFluentBitPayload) Parse(msg []byte) bool

func (*FireLensFluentBitPayload) SetLogAttributes

func (p *FireLensFluentBitPayload) SetLogAttributes(ctx context.Context, hl *hlog.Log, msg []byte) context.Context

type FireLensPayload

type FireLensPayload struct {
	Log    string
	Source string
}

func (*FireLensPayload) GetLevel

func (p *FireLensPayload) GetLevel() string

func (*FireLensPayload) GetMessage

func (p *FireLensPayload) GetMessage() string

func (*FireLensPayload) GetMessages

func (p *FireLensPayload) GetMessages() []PayloadMessage

func (*FireLensPayload) GetTimestamp

func (p *FireLensPayload) GetTimestamp() *time.Time

func (*FireLensPayload) Parse

func (p *FireLensPayload) Parse(msg []byte) bool

func (*FireLensPayload) SetLogAttributes

func (p *FireLensPayload) SetLogAttributes(ctx context.Context, hl *hlog.Log, msg []byte) context.Context

type FireLensPinoPayload

type FireLensPinoPayload struct {
	Message string `json:"msg"`
	Level   uint8  `json:"level"`
	Service string `json:"name"`
	Time    int64  `json:"time"`
}

func (*FireLensPinoPayload) GetLevel

func (p *FireLensPinoPayload) GetLevel() string

func (*FireLensPinoPayload) GetMessage

func (p *FireLensPinoPayload) GetMessage() string

func (*FireLensPinoPayload) GetMessages

func (p *FireLensPinoPayload) GetMessages() []PayloadMessage

func (*FireLensPinoPayload) GetTimestamp

func (p *FireLensPinoPayload) GetTimestamp() *time.Time

func (*FireLensPinoPayload) Parse

func (p *FireLensPinoPayload) Parse(msg []byte) bool

func (*FireLensPinoPayload) SetLogAttributes

func (p *FireLensPinoPayload) SetLogAttributes(ctx context.Context, hl *hlog.Log, msg []byte) context.Context

type FirehosePayload

type FirehosePayload struct {
	RequestId string
	Timestamp int64
	Records   []struct {
		Data string
	}
}

func ExtractFirehoseMetadata

func ExtractFirehoseMetadata(r *http.Request, body []byte) (int, *FirehosePayload, [][]byte, error)

type JsonPayload

type JsonPayload struct {
	Body map[string]any
}

func (*JsonPayload) GetLevel

func (p *JsonPayload) GetLevel() string

func (*JsonPayload) GetMessage

func (p *JsonPayload) GetMessage() string

func (*JsonPayload) GetMessages

func (p *JsonPayload) GetMessages() []PayloadMessage

func (*JsonPayload) GetTimestamp

func (p *JsonPayload) GetTimestamp() *time.Time

func (*JsonPayload) Parse

func (p *JsonPayload) Parse(msg []byte) bool

func (*JsonPayload) SetLogAttributes

func (p *JsonPayload) SetLogAttributes(ctx context.Context, hl *hlog.Log, _ []byte) context.Context

type Payload

type Payload interface {
	Parse([]byte) bool
	GetMessages() []PayloadMessage
}

type PayloadMessage

type PayloadMessage interface {
	GetMessage() string
	GetLevel() string
	GetTimestamp() *time.Time
	SetLogAttributes(ctx context.Context, hl *hlog.Log, msg []byte) context.Context
}

Jump to

Keyboard shortcuts

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