Documentation
¶
Index ¶
Constants ¶
const ( // Defined as <DBName>:<Table> AdxMonLogDestinationAnnotation = "adx-mon/log-destination" // Defined as comma separated parser names AdxMonLogParsersAnnotation = "adx-mon/log-parsers" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileTailTarget ¶
type FileTailTarget struct {
// FilePath is the file to tail.
FilePath string
// LogType is the format of the log file. e.g. docker for logs written by the docker json driver.
// This provides a mechanism to combine split lines, parse timestamps (if present), and extract a message field.
// Defaults to plain.
LogType sourceparse.Type
// The destination database name. Populated into the databasename attribute of the log that can be overwritten by transforms.
Database string
// The destination table name. Populated into the tablename attribute of the log that can be overwritten by transforms.
Table string
// Parsers is a list of parsers names to apply to each line of the log file to attempt to extract fields from the message body.
// These are run sequentially until one succeeds, or until all have been tried.
// These are converted into parser.ParserType.
Parsers []string
// Resources is a map of additional resource k/v pairs to add to each log.
Resources map[string]interface{}
}
FileTailTarget describes a file to tail, how to parse it, and the destination for the parsed logs. It is used in the list of StaticTargets in TailSourceConfig, or used in AddTarget. NOTE: If new fields are added that change during runtime (e.g. from pod metadata changing) that are sent via UpdateChan, update isTargetChanged to take this new field into account.
type PodDiscovery ¶
type PodDiscovery struct {
NodeName string
// contains filtered or unexported fields
}
func NewPodDiscovery ¶
func NewPodDiscovery(opts PodDiscoveryOpts, tailsource TailerSourceInterface) *PodDiscovery
func (*PodDiscovery) Close ¶
func (i *PodDiscovery) Close() error
func (*PodDiscovery) OnAdd ¶
func (i *PodDiscovery) OnAdd(obj interface{}, isInitialList bool)
OnAdd is called when an object is added. Expects a pod.
func (*PodDiscovery) OnDelete ¶
func (i *PodDiscovery) OnDelete(obj interface{})
OnDelete is called when an object is deleted. Expects a pod.
func (*PodDiscovery) OnUpdate ¶
func (i *PodDiscovery) OnUpdate(oldObj, newObj interface{})
OnUpdate is called when an object is updated. Expects a pod.
type PodDiscoveryOpts ¶
type PodDiscoveryOpts struct {
NodeName string
PodInformer k8s.PodInformerInterface
StaticPodTargets []*StaticPodTargets
}
type StaticPodTargets ¶ added in v0.2.0
type TailSource ¶
type TailSource struct {
// contains filtered or unexported fields
}
TailSource implements the types.Source interface for tailing files.
func NewTailSource ¶
func NewTailSource(config TailSourceConfig) (*TailSource, error)
func (*TailSource) AddTarget ¶
func (s *TailSource) AddTarget(target FileTailTarget, updateChan <-chan FileTailTarget) error
AddTarget adds a new file to tail. updateChan is an optional channel to provide updated FileTailTarget metadata during runtime. Does not support updating FilePath or LogType.
func (*TailSource) Close ¶
func (s *TailSource) Close() error
func (*TailSource) Name ¶
func (s *TailSource) Name() string
func (*TailSource) RemoveTarget ¶
func (s *TailSource) RemoveTarget(filePath string)
RemoveTarget removes a file from being tailed. This also removes the cursor file, so this should only be called when the file is not longer expected to be tailed in the future.
type TailSourceConfig ¶
type TailSourceConfig struct {
StaticTargets []FileTailTarget
CursorDirectory string
WorkerCreator engine.WorkerCreatorFunc
// TODO mkeesey - TailSource should not need to manage poddiscovery service lifecycle.
// However, creation of TailSource happens with a create method to access store, making this
// wiring difficult.
PodDiscoveryOpts *PodDiscoveryOpts
}
TailSourceConfig configures TailSource.
type Tailer ¶
type Tailer struct {
// contains filtered or unexported fields
}
Tailer is a specific instance of a file being tailed.
func StartTailing ¶
func StartTailing(config TailerConfig) (*Tailer, error)
type TailerConfig ¶
type TailerConfig struct {
Target FileTailTarget
UpdateChan <-chan FileTailTarget
AckGenerator func(*types.Log) func()
WorkerCreator engine.WorkerCreatorFunc
CursorDirectory string
WorkerName string
}
type TailerSourceInterface ¶
type TailerSourceInterface interface {
AddTarget(target FileTailTarget, updateChan <-chan FileTailTarget) error
RemoveTarget(target string)
}