ecs

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Internal base fields to be used by the logger
	FieldTimestamp = "@timestamp"
	FieldMessage   = "message"
	FieldLabels    = "labels"
	FieldTags      = "tags"

	// Internal label fields to be used by the logger
	FieldLabelApplication = "application"
	FieldLabelService     = "service"
	FieldLabelEnvironment = "environment"
	FieldLabelLibVersion  = "lib_version"
	FieldLabelLibLanguage = "lib_language"
	FieldLabelPodName     = "pod_name"
	FieldLabelNodeName    = "node_name"

	FieldLogger   = "log.logger"
	FieldLogLevel = "log.level"

	// Public fields to be available for consumers
	FieldServiceName = "service.name"

	FieldErrorMessage = "error.message"
	FieldStackTrace   = "error.stack_trace"
	FieldErrorType    = "error.type"

	FieldEventAction   = "event.action"
	FieldEventKind     = "event.kind"
	FieldEventCategory = "event.category"
	FieldEventModule   = "event.module"
	FieldEventType     = "event.type"
	FieldEventOriginal = "event.original"
	FieldEventOutcome  = "event.outcome"

	FieldTraceID = "trace.id"

	FieldHTTPRequestBodyContent   = "http.request.body.content"
	FieldHTTPRequestMethod        = "http.request.method"
	FieldHTTPRequestBodyHeaders   = "http.request.body.headers"
	FieldHTTPRequestReferrer      = "http.request.referrer"
	FieldHTTPResponseBodyContent  = "http.response.body.content"
	FieldHTTPResponseStatusCode   = "http.response.status_code"
	FieldHTTPResponseBodyReferrer = "http.response.body.referrer"
)

Encoding keys used for ECS compliance: https://www.elastic.co/guide/en/ecs/current/ecs-base.html

View Source
const (
	LogPrefix       = "log."
	LogBaseLevelKey = "log"

	HTTPPrefix       = "http."
	HTTPBaseLevelKey = "http"

	EventPrefix       = "event."
	EventBaseLevelKey = "event"

	ErrorPrefix       = "error."
	ErrorBaseLevelKey = "error"

	TracePrefix       = "trace."
	TraceBaseLevelKey = "trace"
)

Variables

This section is empty.

Functions

func Duration

func Duration(key string, val time.Duration) zap.Field

Duration constructs a field with the given key and value.

func Err

func Err(err error) zap.Field

Err constructs an "error" field that carries an error. The returned Field will safely and explicitly represent `nil` when appropriate.

func EventAction

func EventAction(val string) zap.Field

EventAction constructs a String field with the FieldEventAction ECS standard key

func EventCategory

func EventCategory(val string) zap.Field

EventCategory constructs a String field with the FieldEventCategory ECS standard key

func EventKind

func EventKind(val string) zap.Field

EventKind constructs a String field with the FieldEventKind ECS standard key

func EventModule

func EventModule(val string) zap.Field

EventModule constructs a String field with the FieldEventModule ECS standard key

func EventOriginal

func EventOriginal(val string) zap.Field

EventOriginal constructs a String field with the FieldEventOriginal ECS standard key

func EventOutcome

func EventOutcome(val string) zap.Field

EventOutcome constructs a String field with the FieldEventOutcome ECS standard key

func EventType

func EventType(val string) zap.Field

EventType constructs a String field with the FieldEventType ECS standard key

func HTTPRequestBodyContent

func HTTPRequestBodyContent(val string) zap.Field

HTTPRequestBodyContent constructs a String field with the FieldHTTPRequestBodyContent ECS standard key

func HTTPRequestBodyHeaders

func HTTPRequestBodyHeaders(val []http.Header) zap.Field

HTTPRequestBodyHeaders constructs a String field with the FieldHTTPRequestBodyHeaders ECS standard key

func HTTPRequestMethod

func HTTPRequestMethod(val string) zap.Field

HTTPRequestMethod constructs a String field with the FieldHTTPRequestMethod ECS standard key

func HTTPRequestReferrer

func HTTPRequestReferrer(val string) zap.Field

HTTPRequestReferrer constructs a String field with the FieldHTTPRequestReferrer ECS standard key

func HTTPResponseBodyContent

func HTTPResponseBodyContent(val string) zap.Field

HTTPResponseBodyContent constructs a String field with the FieldHTTPResponseBodyContent ECS standard key

func HTTPResponseBodyReferrer

func HTTPResponseBodyReferrer(val string) zap.Field

HTTPResponseBodyReferrer constructs a String field with the FieldHTTPResponseBodyReferrer ECS standard key

func HTTPResponseStatusCode

func HTTPResponseStatusCode(val string) zap.Field

HTTPResponseStatusCode constructs a String field with the FieldHTTPResponseStatusCode ECS standard key

func IsECSFieldName

func IsECSFieldName(fieldName string) bool

func SanitizeHeaders

func SanitizeHeaders(val []http.Header) []string

func ServiceName

func ServiceName(val string) zap.Field

ServiceName constructs a String field with the FieldServiceName ECS standard key

func Tags

func Tags(val []string) zap.Field

Tags constructs a field that carries a string list, with no marshaling as it will be handled later on by the logger

func TraceID

func TraceID(val string) zap.Field

TraceID constructs a String field with the FieldTraceID ECS standard key

Types

This section is empty.

Jump to

Keyboard shortcuts

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