Documentation
¶
Overview ¶
Package logs contains code to fetch logs from Kubernetes pods
Index ¶
- func GetPodLogs(ctx context.Context, pod corev1.Pod, getPrevious bool, writer io.Writer, ...) ([]string, error)
- func StreamPodLogs(ctx context.Context, pod corev1.Pod, writer io.Writer, ...) (err error)
- func TailPodLogs(ctx context.Context, pod corev1.Pod, writer io.Writer, parseTimestamps bool) (err error)
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.