logs

package
v0.0.0-...-d046166 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package logs is used on-device to collect updates to system logs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyLogFileUpdates

func CopyLogFileUpdates(src, dst string, exclude []string, origSizes InodeSizes) (
	warnings map[string]error, err error)

CopyLogFileUpdates takes origSizes, the result of an earlier call to GetLogInodeSizes, and copies new parts of files under directory src to directory dst, creating it if necessary. The exclude arg lists relative paths of directories and files to skip. A nil or empty size map may be passed to copy all files in their entirety. warnings contains non-fatal errors that were accounted, keyed by path.

func ExportUnifiedLogs

func ExportUnifiedLogs(ctx context.Context, w io.Writer, cursor string, fm UnifiedLogFormat) error

ExportUnifiedLogs writes unified system log entries generated after cursor to w using fm. cursor should have been generated by an earlier call to GetUnifiedLogCursor.

func GetUnifiedLogCursor

func GetUnifiedLogCursor(ctx context.Context) (string, error)

GetUnifiedLogCursor returns a log cursor to the current tip of the unified system logs. The return cursor can later be passed to WriteLogs.

Types

type InodeSizes

type InodeSizes map[uint64]int64

InodeSizes maps from inode to file size.

func GetLogInodeSizes

func GetLogInodeSizes(dir string, exclude []string) (
	inodes InodeSizes, warnings map[string]error, err error)

GetLogInodeSizes recursively walks dir and returns a map from inode to size in bytes for all regular files. warnings contains non-fatal errors that were accounted, keyed by path. Exclude lists relative paths of directories and files to skip.

type UnifiedLogFormat

type UnifiedLogFormat int

UnifiedLogFormat is a format for syslog entries.

const (
	// CompactLogFormat corresponds to human-readable single-line log entries.
	CompactLogFormat UnifiedLogFormat = iota
	// GzippedExportLogFormat corresponds to croslog's "--output=export" multiline format that preserves metadata.
	// The data is additionally gzip-compressed.
	GzippedExportLogFormat
)

Jump to

Keyboard shortcuts

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