Documentation ¶
Index ¶
- Constants
- func AggregationTimeout() time.Duration
- func BuildEndpoints(httpConnectivity HTTPConnectivity) (*Endpoints, error)
- func BuildHTTPEndpoints() (*Endpoints, error)
- func ContainsWildcard(path string) bool
- func ExpectedTagsDuration() time.Duration
- func GlobalProcessingRules() ([]*ProcessingRule, error)
- func IsExpectedTagsSet() bool
- func TaggerWarmupDuration() time.Duration
- type CountInfo
- type HTTPConnectivity
- type InfoProvider
- type LogSource
- func (s *LogSource) AddInput(input string)
- func (s *LogSource) GetInfo(key string) InfoProvider
- func (s *LogSource) GetInfoStatus() map[string][]string
- func (s *LogSource) GetInputs() []string
- func (s *LogSource) GetSourceType() SourceType
- func (s *LogSource) RegisterInfo(i InfoProvider)
- func (s *LogSource) RemoveInput(input string)
- func (s *LogSource) SetSourceType(sourceType SourceType)
- type LogSources
- type LogStatus
- type LogsConfig
- type MappedInfo
- type Messages
- type SourceType
- type TailingMode
Constants ¶
const ( ChanSize = 100 NumberOfPipelines = 4 )
Pipeline constraints
const ( TCPType = "tcp" UDPType = "udp" FileType = "file" DockerType = "docker" JournaldType = "journald" WindowsEventType = "windows_event" SnmpTrapsType = "snmp_traps" StringChannelType = "string_channel" // UTF16BE for UTF-16 Big endian encoding UTF16BE string = "utf-16-be" // UTF16LE for UTF-16 Little Endian encoding UTF16LE string = "utf-16-le" )
Logs source types
const ( ForceBeginning = iota ForceEnd Beginning End )
Tailing Modes
const ContainerCollectAll = "container_collect_all"
ContainerCollectAll is the name of the docker integration that collect logs from all containers
const (
// DateFormat is the default date format.
DateFormat = "2006-01-02T15:04:05.000000000Z"
)
const SnmpTraps = "snmp_traps"
SnmpTraps is the name of the integration that collects logs from SNMP traps received by the Agent
Variables ¶
This section is empty.
Functions ¶
func AggregationTimeout ¶
AggregationTimeout is used when performing aggregation operations
func BuildEndpoints ¶
func BuildEndpoints(httpConnectivity HTTPConnectivity) (*Endpoints, error)
BuildEndpoints returns the endpoints to send logs.
func BuildHTTPEndpoints ¶
func BuildHTTPEndpoints() (*Endpoints, error)
BuildHTTPEndpoints returns the HTTP endpoints to send logs to.
func ContainsWildcard ¶
ContainsWildcard returns true if the path contains any wildcard character
func ExpectedTagsDuration ¶
ExpectedTagsDuration returns a duration of the time expected tags will be submitted for.
func GlobalProcessingRules ¶
func GlobalProcessingRules() ([]*ProcessingRule, error)
GlobalProcessingRules returns the global processing rules to apply to all logs.
func IsExpectedTagsSet ¶
func IsExpectedTagsSet() bool
IsExpectedTagsSet returns boolean showing if expected tags feature is enabled.
func TaggerWarmupDuration ¶
TaggerWarmupDuration is used to configure the tag providers
Types ¶
type CountInfo ¶
type CountInfo struct {
// contains filtered or unexported fields
}
CountInfo records a simple count
func NewCountInfo ¶
NewCountInfo creates a new CountInfo instance
type HTTPConnectivity ¶
type HTTPConnectivity bool
HTTPConnectivity is the status of the HTTP connectivity
var ( // HTTPConnectivitySuccess is the status for successful HTTP connectivity HTTPConnectivitySuccess HTTPConnectivity = true // HTTPConnectivityFailure is the status for failed HTTP connectivity HTTPConnectivityFailure HTTPConnectivity = false )
type InfoProvider ¶
InfoProvider is a general interface to provide info about a log source. It is used in the agent status page. The expected usage is for a piece of code that wants to surface something on the status page register an info provider with the source with a unique key/name. This file contains useful base implementations, but InfoProvider can be extended/implemented for more complex data.
When implementing InfoProvider - be aware of the 2 ways it is used by the status page:
- when a single message is returned, the statuspage will display a single line: InfoKey(): Info()[0]
- when multiple messages are returned, the status page will display an indented list: InfoKey(): Info()[0] Info()[1] Info()[n]
InfoKey only needs to be unique per source, and should be human readable.
type LogSource ¶
type LogSource struct { // Put expvar Int first because it's modified with sync/atomic, so it needs to // be 64-bit aligned on 32-bit systems. See https://golang.org/pkg/sync/atomic/#pkg-note-BUG BytesRead expvar.Int Name string Config *LogsConfig Status *LogStatus Messages *Messages // In the case that the source is overridden, keep a reference to the parent for bubbling up information about the child ParentSource *LogSource // LatencyStats tracks internal stats on the time spent by messages from this source in a processing pipeline, i.e. // the duration between when a message is decoded by the tailer/listener/decoder and when the message is handled by a sender LatencyStats *util.StatsTracker // contains filtered or unexported fields }
LogSource holds a reference to an integration name and a log configuration, and allows to track errors and successful operations on it. Both name and configuration are static for now and determined at creation time. Changing the status is designed to be thread safe.
func ContainerCollectAllSource ¶
func ContainerCollectAllSource() *LogSource
ContainerCollectAllSource returns a source to collect all logs from all containers.
func NewLogSource ¶
func NewLogSource(name string, config *LogsConfig) *LogSource
NewLogSource creates a new log source.
func SNMPTrapsSource ¶
func SNMPTrapsSource() *LogSource
SNMPTrapsSource returs a source to forward SNMP traps as logs.
func (*LogSource) GetInfo ¶
func (s *LogSource) GetInfo(key string) InfoProvider
GetInfo gets an InfoProvider instance by the key
func (*LogSource) GetInfoStatus ¶
GetInfoStatus returns a primitive representation of the info for the status page
func (*LogSource) GetSourceType ¶
func (s *LogSource) GetSourceType() SourceType
GetSourceType returns the sourceType used by this source
func (*LogSource) RegisterInfo ¶
func (s *LogSource) RegisterInfo(i InfoProvider)
RegisterInfo registers some info to display on the status page
func (*LogSource) RemoveInput ¶
RemoveInput removes an input from this source.
func (*LogSource) SetSourceType ¶
func (s *LogSource) SetSourceType(sourceType SourceType)
SetSourceType sets a format that give information on how the source lines should be parsed
type LogSources ¶
type LogSources struct {
// contains filtered or unexported fields
}
LogSources stores a list of log sources.
func CreateSources ¶
func CreateSources(sourcesArray []*LogSource) *LogSources
CreateSources creates sources
func (*LogSources) AddSource ¶
func (s *LogSources) AddSource(source *LogSource)
AddSource adds a new source.
func (*LogSources) GetAddedForType ¶
func (s *LogSources) GetAddedForType(sourceType string) chan *LogSource
GetAddedForType returns the new added sources matching the provided type.
func (*LogSources) GetRemovedForType ¶
func (s *LogSources) GetRemovedForType(sourceType string) chan *LogSource
GetRemovedForType returns the new removed sources matching the provided type.
func (*LogSources) GetSources ¶
func (s *LogSources) GetSources() []*LogSource
GetSources returns all the sources currently held.
func (*LogSources) RemoveSource ¶
func (s *LogSources) RemoveSource(source *LogSource)
RemoveSource removes a source.
type LogStatus ¶
type LogStatus struct {
// contains filtered or unexported fields
}
LogStatus tracks errors and success.
type LogsConfig ¶
type LogsConfig struct { Type string `yaml:"type"` Port int `yaml:"port"` // Network Path string `yaml:"path"` // File, Journald Encoding string `yaml:"encoding"` // File ExcludePaths []string `yaml:"excludePaths"` // File TailingMode string `yaml:"startPosition"` // File IncludeUnits []string `yaml:"includeUnits"` // Journald ExcludeUnits []string `yaml:"excludeUnits"` // Journald ContainerMode bool `yaml:"containerMode"` // Journald Image string `yaml:"image"` // Docker Label string `yaml:"label"` // Docker Name string `yaml:"name"` // Docker Name contains the container name Identifier string `yaml:"identifier"` // Docker Identifier contains the container ID ChannelPath string `yaml:"channelPath"` // Windows Event Query string `yaml:"query"` // Windows Event // used as input only by the Channel tailer. // could have been unidirectional but the tailer could not close it in this case. // TODO(remy): strongly typed to an AWS Lambda LogMessage, we should probably use // a more generic type here. Channel chan aws.LogMessage `yaml:"channel"` Service string `yaml:"service"` Source string `yaml:"source"` SourceCategory string `yaml:"sourceCategory"` Tags []string `yaml:"tags"` ProcessingRules []*ProcessingRule `yaml:"logProcessingRules"` }
LogsConfig represents a log source config, which can be for instance a file to tail or a port to listen to.
func ParseJSON ¶
func ParseJSON(data []byte) ([]*LogsConfig, error)
ParseJSON parses the data formatted in JSON returns an error if the parsing failed.
func ParseYAML ¶
func ParseYAML(data []byte) ([]*LogsConfig, error)
ParseYAML parses the data formatted in YAML, returns an error if the parsing failed.
func (*LogsConfig) Validate ¶
func (c *LogsConfig) Validate() error
Validate returns an error if the config is misconfigured
type MappedInfo ¶
type MappedInfo struct {
// contains filtered or unexported fields
}
MappedInfo collects multiple info messages with a unique key
func NewMappedInfo ¶
func NewMappedInfo(key string) *MappedInfo
NewMappedInfo creates a new MappedInfo instance
func (*MappedInfo) RemoveMessage ¶
func (m *MappedInfo) RemoveMessage(key string)
RemoveMessage removes a message with a unique key
func (*MappedInfo) SetMessage ¶
func (m *MappedInfo) SetMessage(key string, message string)
SetMessage sets a message with a unique key
type Messages ¶
type Messages struct {
// contains filtered or unexported fields
}
Messages holds messages and warning that can be displayed in the status Warnings are display at the top of the log section in the status and messages are displayed in the log source that generated the message
func NewMessages ¶
func NewMessages() *Messages
NewMessages initialize Messages with the default values
func (*Messages) AddMessage ¶
AddMessage create a message
func (*Messages) GetMessages ¶
GetMessages returns all the messages
func (*Messages) RemoveMessage ¶
RemoveMessage removes a message
type SourceType ¶
type SourceType string
SourceType used for log line parsing logic. TODO: remove this logic.
const ( // DockerSourceType docker source type DockerSourceType SourceType = "docker" // KubernetesSourceType kubernetes source type KubernetesSourceType SourceType = "kubernetes" )
type TailingMode ¶
type TailingMode uint8
TailingMode type
func TailingModeFromString ¶
func TailingModeFromString(mode string) (TailingMode, bool)
TailingModeFromString parses a string and returns a corresponding tailing mode, default to End if not found
func (TailingMode) String ¶
func (mode TailingMode) String() string
TailingModeToString returns seelog string representation for a specified tailing mode. Returns "" for invalid tailing mode.