Documentation
¶
Overview ¶
Package common contains the structs and logic that form the basis of protonds operation.
All other protond modules rely on a subset of the functionality provided here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseEventData ¶
ParseEventData will convert the supplied string to an Event struct pointer.
func PathExists ¶
PathExists determines whether or not the specified path exists on disk.
Types ¶
type Config ¶
type Config struct { ConfFile string `` /* 174-byte string literal not displayed */ Backlog int `` /* 173-byte string literal not displayed */ NumWorkers int `` /* 206-byte string literal not displayed */ FilterTimeout time.Duration `` /* 199-byte string literal not displayed */ InputDirectory string `` /* 212-byte string literal not displayed */ OutputDirectory string `` /* 212-byte string literal not displayed */ FilterDirectory string `` /* 216-byte string literal not displayed */ DataDir string `` /* 169-byte string literal not displayed */ PidFile string `` /* 173-byte string literal not displayed */ Log *Logger `skip:"true"` // The internal logger to use Inputs []*PluginConfig `skip:"true"` // The raw input configurations to use for event ingestion Outputs []*PluginConfig `skip:"true"` // The raw input configurations to use for event propagation Filters []*FilterConfig `skip:"true"` // The raw javascript filters to use during event filtering // contains filtered or unexported fields }
Config struct that handles marshalling in user supplied configuration data from cli arguments, environment variables, and configuration file entries.
The user supplied configuration is processed via a structured hierarchy:
- Cli arguments override both environment variables and configuration file entries.
- Environment variables will override file entries but can be overridden by cli arguments.
- Configuration file entries will be overridden by both environment variables and cli arguments.
- Defaults are used in the case that the use does not define a configuration argument.
The only exceptions to the above are the two special cli argments '-h'|'--help' or '-v'|'--version' which will output usage information or version information respectively and then exit the application.
type Event ¶
type Event struct { Timestamp time.Time `json:"timestamp"` Input string `json:"input"` Data map[string]interface{} `json:"data"` }
Event represents an arbitrary event passing through protond.
type FilterConfig ¶
FilterConfig is a struct representing a javascript filters name and underlying code.
type Logger ¶
type Logger struct { Plain *log.Logger Error *log.Logger Info *log.Logger Warn *log.Logger Debug *log.Logger }
Logger struct which allows for a single global point for logging configuration.
func NewLogger ¶
func NewLogger(loggerType LoggerType) *Logger
NewLogger creates a new logger struct based on the supplied LoggerType.
type LoggerType ¶
type LoggerType int
LoggerType will determine the logging level of the logger object created.
const ( // NoopLogger will noop all logging calls this is only used for testing. NoopLogger LoggerType = iota // ErrorLogger will only output error logs. ErrorLogger // WarnLogger will output warn/error logs. WarnLogger // InfoLogger will output info/warn/error logs. InfoLogger // DebugLogger will output debug/info/warn/error logs. DebugLogger )
type PluginConfig ¶
type PluginConfig struct { Type string `json:"type" yaml:"type"` Name string `json:"name" yaml:"name"` Config map[string]string `json:"config" yaml:"config"` }
PluginConfig is a struct representing a input plugin configuration.
func ParsePluginConfigs ¶
func ParsePluginConfigs(dir string, log *Logger) ([]*PluginConfig, error)
ParsePluginConfigs parses a directory of files and returns the resulting array of configs.
type Signaler ¶
type Signaler struct {
// contains filtered or unexported fields
}
Signaler struct used to manage os and user signals to the protond process.
func NewSignaler ¶
NewSignaler generates a new Signaler object, which will watch for new os and user signals passed to the protond process.