logs

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package logs contains code to fetch logs from Kubernetes pods

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPodLogs

func GetPodLogs(ctx context.Context, pod corev1.Pod, getPrevious bool, writer io.Writer, requestedLineLength int) (
	[]string, error,
)

GetPodLogs streams the pod logs and shunts them to the `writer`, as well as returning the last `requestedLineLength` of lines of logs in a slice. If `getPrevious` was activated, it will get the previous logs

func StreamPodLogs

func StreamPodLogs(
	ctx context.Context,
	pod corev1.Pod,
	writer io.Writer,
	podLogOptions *corev1.PodLogOptions,
) (err error)

StreamPodLogs streams the pod logs and shunts them to the `writer`.

func TailPodLogs added in v1.18.1

func TailPodLogs(ctx context.Context, pod corev1.Pod, writer io.Writer, parseTimestamps bool) (err error)

TailPodLogs streams the pod logs starting from the current time, and keeps waiting for any new logs, until the context is cancelled by the calling process If `parseTimestamps` is true, the log line will have the timestamp in human-readable prepended. NOTE: this will make log-lines NON-JSON

Types

This section is empty.

Jump to

Keyboard shortcuts

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