googlecloudlogk8snode_contract

package
v0.58.4 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package googlecloudlogk8snode_contract defines the contract for the googlecloudlogk8snode task.

Index

Constants

View Source
const (
	// TaskIDPrefix is the prefix for all task IDs in this package.
	TaskIDPrefix = "cloud.google.com/log/k8s-node/"
)

Variables

View Source
var (
	// RevisionStateComponentRunning represents that a node component is running successfully.
	RevisionStateComponentRunning = style.MustRegisterRevisionState(
		"Component is running",
		"check_circle",
		"The node component (e.g., kubelet, kube-proxy) is running normally.",
		style.MustForceConvertSRGBHex("#00cc66"),
		pb.RevisionStateStyle_REVISION_STATE_STYLE_NORMAL,
	)

	// RevisionStateComponentTerminated represents that a node component has terminated or stopped.
	RevisionStateComponentTerminated = style.MustRegisterRevisionState(
		"Component is terminated",
		"cancel",
		"The node component has terminated or stopped.",
		style.MustForceConvertSRGBHex("#ff3333"),
		pb.RevisionStateStyle_REVISION_STATE_STYLE_DELETED,
	)
)

ClusterIdentityTaskID is the task id for aliasing the cluster identity.

View Source
var ContainerdLogFilterTaskID = taskid.NewDefaultImplementationID[[]*log.Log](TaskIDPrefix + "containerd-log-filter")

ContainerdLogFilterTaskID is the ID for a task to filter only the logs for containerd.

View Source
var ContainerdLogGroupTaskID = taskid.NewDefaultImplementationID[inspectiontaskbase.LogGroupMap](TaskIDPrefix + "containerd-log-group")

ContainerdLogGroupTaskID is the ID for a task to group containerd related logs based on instance names.

View Source
var ContainerdLogLogToTimelineMapperTaskID = taskid.NewDefaultImplementationID[struct{}](TaskIDPrefix + "containerd-log-timeline-mapper")

ContainerdLogLogToTimelineMapperTaskID is the ID for a task to add events or revisions based on containerd logs.

View Source
var DefaultNodeLogParser = logutil.NewSelectorLogParser[NodeLogContext](
	logutil.NewMultiTextLogParser(
		logutil.NewJsonlTextParser(),
		logutil.NewKLogTextParser(true),
		logutil.NewLogfmtTextParser(),
		&logutil.FallbackRawTextLogParser{},
	),
	logutil.ParserRule[NodeLogContext]{
		Match: func(ctx NodeLogContext) bool {
			return ctx.SyslogIdentifier == "kubelet"
		},
		Parser: logutil.NewKLogTextParser(true),
	},
	logutil.ParserRule[NodeLogContext]{
		Match: func(ctx NodeLogContext) bool {
			return ctx.SyslogIdentifier == "containerd"
		},
		Parser: logutil.NewLogfmtTextParser(),
	},
)

DefaultNodeLogParser is the default SelectorLogParser for GKE node logs.

View Source
var KubeletLogFilterTaskID = taskid.NewDefaultImplementationID[[]*log.Log](TaskIDPrefix + "kubelet-log-filter")

KubeletLogFilterTaskID is the ID for a task to filter only the logs for kubelet.

View Source
var KubeletLogGroupTaskID = taskid.NewDefaultImplementationID[inspectiontaskbase.LogGroupMap](TaskIDPrefix + "kubelet-log-group")

KubeletLogGroupTaskID is the ID for a task to group kubelet related logs based on instance names.

View Source
var KubeletLogLogToTimelineMapperTaskID = taskid.NewDefaultImplementationID[struct{}](TaskIDPrefix + "kubelet-log-timeline-mapper")

KubeletLogLogToTimelineMapperTaskID is the ID for a task to add events or revisions based on kubelet logs.

View Source
var ListLogEntriesTaskID = taskid.NewDefaultImplementationID[[]*log.Log](TaskIDPrefix + "query")

ListLogEntriesTaskID is the task id for the task that queries k8s node logs from Cloud Logging.

View Source
var LogIngesterTaskID = taskid.NewDefaultImplementationID[struct{}](TaskIDPrefix + "log-ingester")

LogIngesterTaskID is the task ID to finalize the logs to be included in the final output.

View Source
var (
	LogTypeNode = style.MustRegisterLogType("k8s node", "Kubernetes Node Logs", style.MustForceConvertSRGBHex("#0077CC"), style.ColorWhite)
)

The following block defines the registered timeline style LogTypes. These are registered as package-level variables so they are initialized immediately when this package is imported.

View Source
var NodeNameDiscoveryTaskID = taskid.NewDefaultImplementationID[[]string](TaskIDPrefix + "node-name-discovery")

NodeNameDiscoveryTaskID is the task ID for extracting node names from Kubernetes node logs.

View Source
var OtherLogFilterTaskID = taskid.NewDefaultImplementationID[[]*log.Log](TaskIDPrefix + "other-log-filter")

OtherLogFilterTaskID is the task ID for filtering other logs.

OtherLogGroupTaskID is the ID for a task to group other related logs based on instance names and component name.

View Source
var OtherLogLogToTimelineMapperTaskID = taskid.NewDefaultImplementationID[struct{}](TaskIDPrefix + "other-log-timeline-mapper")

OtherLogLogToTimelineMapperTaskID is the task ID for a task to add events or revisions based on other logs.

View Source
var PodSandboxIDDiscoveryTaskID = taskid.NewDefaultImplementationID[patternfinder.PatternFinder[*PodSandboxIDInfo]](TaskIDPrefix + "containerd-id-discovery")

PodSandboxIDDiscoveryTaskID is the ID for a task to extract pod sandbox IDs for the other parsers to correlate a log to Pods.

View Source
var TailTaskID = taskid.NewDefaultImplementationID[struct{}](TaskIDPrefix + "tail")

TailTaskID is a nop task just to require all child parsers.

View Source
var (
	TimelineTypeNodeComponent = style.MustRegisterTimelineType(
		"node-component",
		"Logs of non-containerized system components on the node",
		"manufacturing",
		0.6,
		style.ColorWhite,
		style.ColorBlack,
		style.MustForceConvertSRGBHex("#0077CC"),
		style.ColorWhite,
		true,
		6000,
		style.AlphabeticalSortPolicy(),
	)
)

The following block defines the registered timeline style TimelineTypes. These are registered as package-level variables so they are initialized immediately when this package is imported.

Functions

func MustNodeComponentTimeline added in v0.56.0

func MustNodeComponentTimeline(ctx context.Context, nodeTimeline *khifilev6.TimelinePath, componentName string) *khifilev6.TimelinePath

MustNodeComponentTimeline returns the timeline path for a node component (e.g., containerd, kubelet).

Types

type K8sNodeLogCommonFieldSet

type K8sNodeLogCommonFieldSet struct {
	Message   *logutil.ParseStructuredLogResult
	Component string
	NodeName  string
}

K8sNodeLogCommonFieldSet contains the common parsed metadata from a Kubernetes node log.

func ExtractK8sNodeLogCommon added in v0.58.2

func ExtractK8sNodeLogCommon(reader *structured.NodeReader, parser *logutil.SelectorLogParser[NodeLogContext]) (K8sNodeLogCommonFieldSet, error)

ExtractK8sNodeLogCommon extracts K8sNodeLogCommonFieldSet from a NodeReader.

type K8sNodeParserType

type K8sNodeParserType string

K8sNodeParserType defines the parser category for node logs.

var (
	// Containerd identifies containerd logs.
	Containerd K8sNodeParserType = "containerd"
	// Kubelet identifies kubelet logs.
	Kubelet K8sNodeParserType = "kubelet"
	// Other identifies other node component logs.
	Other K8sNodeParserType = "other"
)

func ExtractK8sNodeParserType added in v0.58.2

func ExtractK8sNodeParserType(reader *structured.NodeReader) (K8sNodeParserType, error)

ExtractK8sNodeParserType extracts the K8sNodeParserType from a NodeReader without parsing the log message.

type NodeLogContext added in v0.57.3

type NodeLogContext struct {
	SyslogIdentifier string
	NodeName         string
}

NodeLogContext defines the contextual metadata of a node log used for parser routing.

type PodSandboxIDInfo

type PodSandboxIDInfo struct {
	PodName      string
	PodNamespace string
	PodSandboxID string
}

Jump to

Keyboard shortcuts

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