paths

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 3 Imported by: 69

Documentation

Overview

Package paths provides a common way to handle paths configuration for all Beats.

Currently the following paths are defined:

path.home - It’s the default folder for everything that doesn't fit in the categories below

path.data - Contains things that are expected to change often during normal operations (“registry” files, UUID file, etc.)

path.config - Configuration files and Elasticsearch template default location

The owning application decides how these values are populated, for example from CLI flags or its configuration file.

Use the Resolve method on a *Path to resolve files to their absolute paths. For example, to look for a file in the config path:

cfgfilePath := p.Resolve(paths.Config, "beat.yml")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileType

type FileType string

FileType is an enumeration type representing the file types. Currently existing file types are: Home, Config, Data

const (
	// Home is the "root" directory for the running beats instance
	Home FileType = "home"
	// Config is the path to the beat config
	Config FileType = "config"
	// Data is the path to the beat data directory
	Data FileType = "data"
	// Logs is the path to the beats logs directory
	Logs FileType = "logs"
)

type Path

type Path struct {
	Home   string
	Config string
	Data   string
	Logs   string
}

Path tracks user-configurable path locations and directories

func New

func New() *Path

New returns a Path with all values empty.

func (*Path) InitPaths

func (paths *Path) InitPaths(cfg *Path) error

InitPaths copies cfg into paths, filling unset values with defaults derived from Home. It also creates the data directory on disk and returns an error on failure.

func (*Path) Resolve

func (paths *Path) Resolve(fileType FileType, path string) string

Resolve resolves a path to a location in one of the default folders. For example, Resolve(Home, "test") returns an absolute path for "test" in the home path. An absolute path is returned unchanged.

func (*Path) String

func (paths *Path) String() string

String returns a textual representation

Jump to

Keyboard shortcuts

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