Documentation ¶
Overview ¶
Package logs is used on-device to collect updates to system logs.
Index ¶
- func CopyLogFileUpdates(src, dst string, exclude []string, origSizes InodeSizes) (warnings map[string]error, err error)
- func ExportUnifiedLogs(ctx context.Context, w io.Writer, cursor string, fm UnifiedLogFormat) error
- func GetUnifiedLogCursor(ctx context.Context) (string, error)
- type InodeSizes
- type UnifiedLogFormat
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 ¶
ExportUnifiedLogs writes unified system log entries generated after cursor to w using fm. cursor should have been generated by an earlier call to GetUnifiedLogCursor.
Types ¶
type InodeSizes ¶
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 )