punt

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2018 License: MIT Imports: 22 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GCIndexes

func GCIndexes(esClient *elastic.Client, prefix string, config GCConfig)

func NewStatsdClient

func NewStatsdClient(prefix string, tags []string) *statsd.Client

New creates a new DogStatsD client.

Types

type Action

type Action struct {
	Name string
	// contains filtered or unexported fields
}

func NewAction

func NewAction(state *State, name string, config ActionConfig) *Action

func (*Action) Run

func (a *Action) Run(infos []*AlertInfo)

type ActionConfig

type ActionConfig struct {
	Type   string                 `json:"type"`
	Config map[string]interface{} `json:"config"`
}

type ActionImpl

type ActionImpl interface {
	Run([]*AlertInfo)
}

func GetActionImplementation

func GetActionImplementation(name string, config map[string]interface{}) ActionImpl

type Alert

type Alert struct {
	Name   string
	Action *Action
	State  *State
	Config AlertConfig
	// contains filtered or unexported fields
}

func NewAlert

func NewAlert(state *State, name string, config AlertConfig) *Alert

func (*Alert) Emit

func (a *Alert) Emit(info *AlertInfo)

func (*Alert) Run

func (a *Alert) Run(data map[string]interface{})

type AlertConfig

type AlertConfig struct {
	Type         string                 `json:"type"`
	Sources      []string               `json:"sources"`
	Action       string                 `json:"action"`
	Config       map[string]interface{} `json:"config"`
	RollupWindow int                    `json:"rollup_window"`
}

type AlertImpl

type AlertImpl interface {
	Check(map[string]interface{}) *AlertInfo
}

func GetAlertImplementation

func GetAlertImplementation(name string, config map[string]interface{}) AlertImpl

type AlertInfo

type AlertInfo struct {
	Title       string
	Description string
	Fields      map[string]string
	Log         map[string]interface{}
}

type Cluster

type Cluster struct {
	Name     string
	State    *State
	Config   ClusterConfig
	Incoming chan *elastic.BulkIndexRequest
	// contains filtered or unexported fields
}

func NewCluster

func NewCluster(state *State, name string, config ClusterConfig) *Cluster

func (*Cluster) Run

func (c *Cluster) Run() error

type ClusterConfig

type ClusterConfig struct {
	URL            string                   `json:"url"`
	NumWorkers     int                      `json:"num_workers"`
	BulkSize       int                      `json:"bulk_size"`
	CommitInterval int                      `json:"commit_interval"`
	Reliability    ClusterReliabilityConfig `json:"reliability"`
	Servers        []ClusterServerConfig    `json:"servers"`
	Debug          bool                     `json:"debug"`
	BufferSize     int                      `json:"buffer_size"`
}

type ClusterReliabilityConfig

type ClusterReliabilityConfig struct {
	InsertRetries int `json:"insert_retries"`
	RetryDelay    int `json:"retry_delay"`
}

type ClusterServerConfig

type ClusterServerConfig struct {
	Type         string `json:"type"`
	Bind         string `json:"bind"`
	OctetCounted bool   `json:"octet_counted"`
	CertFile     string `json:"tls_cert_file"`
	KeyFile      string `json:"tls_key_file"`
}

type ClusterWorker

type ClusterWorker struct {
	Cluster *Cluster
	// contains filtered or unexported fields
}

func NewClusterWorker

func NewClusterWorker(cluster *Cluster) *ClusterWorker

type Config

type Config struct {
	Clusters      map[string]ClusterConfig `json:"clusters"`
	Types         map[string]TypeConfig    `json:"types"`
	Mappings      map[string]Mapping       `json:"mappings"`
	Alerts        map[string]AlertConfig   `json:"alerts"`
	Actions       map[string]ActionConfig  `json:"actions"`
	ControlSocket ControlSocketConfig      `json:"control_socket"`
	GC            map[string]GCConfig      `json:"gc"`
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

type ControlSocket

type ControlSocket struct {
	// contains filtered or unexported fields
}

func NewControlSocket

func NewControlSocket(state *State, bind string) (*ControlSocket, error)

func (*ControlSocket) Run

func (cs *ControlSocket) Run()

type ControlSocketConfig

type ControlSocketConfig struct {
	Bind    string `json:"bind"`
	Enabled bool   `json:"enabled"`
}

type DirectTransformer

type DirectTransformer struct{}

Doesn't perform any transformation or parsing on the syslog structure

func NewDirectTransformer

func NewDirectTransformer(config map[string]interface{}) *DirectTransformer

func (*DirectTransformer) Transform

func (b *DirectTransformer) Transform(parts syslog.SyslogData) (map[string]interface{}, error)

type DiscordWebhookAction

type DiscordWebhookAction struct {
	URL   string
	Color uint
}

func NewDiscordWebhookAction

func NewDiscordWebhookAction(config map[string]interface{}) *DiscordWebhookAction

func (*DiscordWebhookAction) Run

func (dwa *DiscordWebhookAction) Run(infos []*AlertInfo)

type Embed

type Embed struct {
	Title       string       `json:"title"`
	Description string       `json:"description"`
	URL         string       `json:"url"`
	Color       uint         `json:"color"`
	Timestamp   string       `json:"timestamp,omitempty"`
	Fields      []EmbedField `json:"fields"`
}

func (*Embed) AddField

func (e *Embed) AddField(name, value string, inline bool)

type EmbedField

type EmbedField struct {
	Name   string `json:"name"`
	Value  string `json:"value"`
	Inline bool   `json:"inline"`
}

type GCConfig

type GCConfig struct {
	Keep int `json:"keep"`
}

type GeoIPMutator

type GeoIPMutator struct {
	InputField   string
	OutputFields map[string]interface{}
	// contains filtered or unexported fields
}

func NewGeoIPMutator

func NewGeoIPMutator(config map[string]interface{}) (*GeoIPMutator, error)

func (*GeoIPMutator) Mutate

func (m *GeoIPMutator) Mutate(data map[string]interface{}) error

type Mapping

type Mapping struct {
	Name   string                  `json:"name"`
	Fields map[string]MappingField `json:"fields"`
	All    bool                    `json:"all"`
}

func (Mapping) GenerateJSON

func (m Mapping) GenerateJSON() map[string]interface{}

func (Mapping) PutMapping

func (m Mapping) PutMapping(client *elastic.Client) error

type MappingField

type MappingField struct {
	Type  string `json:"type"`
	Index bool   `json:"index"`
}

type MatchAlert

type MatchAlert struct {
	// contains filtered or unexported fields
}

func NewMatchAlert

func NewMatchAlert(config map[string]interface{}) *MatchAlert

func (*MatchAlert) Check

func (ma *MatchAlert) Check(data map[string]interface{}) *AlertInfo

type MessagePayload

type MessagePayload struct {
	Embeds []Embed `json:"embeds"`
}

type Mutator

type Mutator interface {
	Mutate(map[string]interface{}) error
}

func GetMutator

func GetMutator(name string, config map[string]interface{}) (Mutator, error)

type State

type State struct {
	Config *Config

	Clusters map[string]*Cluster
	Types    map[string]*Type
	Alerts   map[string]*Alert
	Actions  map[string]*Action
	Exit     chan bool
}

func NewState

func NewState(config *Config) *State

func (*State) Run

func (s *State) Run()

type TailRequest

type TailRequest struct {
	StreamType string
	Filter     map[string]string
	Sample     int
}

type Transformer

type Transformer interface {
	Transform(parts syslog.SyslogData) (map[string]interface{}, error)
}

func GetTransformer

func GetTransformer(name string, config map[string]interface{}) Transformer

type Type

type Type struct {
	Config      TypeConfig
	Transformer Transformer
	Mutators    []Mutator
	Alerts      []*Alert
	// contains filtered or unexported fields
}

func NewType

func NewType(config TypeConfig) *Type

func (*Type) SyncIndexTemplate

func (t *Type) SyncIndexTemplate(esClient *elastic.Client, config *Config) error

type TypeConfig

type TypeConfig struct {
	Prefix      string `json:"prefix"`
	MappingType string `json:"mapping_type"`
	DateFormat  string `json:"date_format"`
	Transformer struct {
		Name   string                 `json:"name"`
		Config map[string]interface{} `json:"config"`
	} `json:"transformer"`
	Mutators []map[string]interface{} `json:"mutators"`
	Template *struct {
		NumReplicas     *int     `json:"num_replicas"`
		NumShards       *int     `json:"num_shards"`
		RefreshInterval *string  `json:"refresh_interval"`
		Mappings        []string `json:"mappings"`
	} `json:"template"`
}

type TypeSubscriber

type TypeSubscriber struct {
	// contains filtered or unexported fields
}

func NewTypeSubscriber

func NewTypeSubscriber() *TypeSubscriber

type UnpackMergeTransformer

type UnpackMergeTransformer struct{}

Parses the log line as JSON and merges it into the syslog structure

func NewUnpackMergeTransformer

func NewUnpackMergeTransformer(config map[string]interface{}) *UnpackMergeTransformer

func (*UnpackMergeTransformer) Transform

func (u *UnpackMergeTransformer) Transform(parts syslog.SyslogData) (map[string]interface{}, error)

type UnpackTakeTransformer

type UnpackTakeTransformer struct{}

Parses the log line as JSON and uses it as the core structure (ignoring syslog data)

func NewUnpackTakeTransformer

func NewUnpackTakeTransformer(config map[string]interface{}) *UnpackTakeTransformer

func (*UnpackTakeTransformer) Transform

func (u *UnpackTakeTransformer) Transform(parts syslog.SyslogData) (map[string]interface{}, error)

Jump to

Keyboard shortcuts

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