tact

package module
v0.0.0-...-50e0b1d Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

README

Tact Go Report Card

Tact is a opinionated agentless machine data extraction framework written in Go

This is alpha quality and API may change without notice

Todo
  • Tests
  • Server and API
  • Cli, status, nodes, slaves, scheduler, etc
  • Master/slave servers
  • Evaluate persisting node config in Store
  • Hashicorp Vault integration
  • Sink/Write drivers
  • Documentation

Written by Bruno Moura brunotm@gmail.com, Licensed under the Apache License, Version 2.0.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Registry default collector registry
	Registry *registry
	// Store default persistence store
	Store storage.Store
)

Functions

func BuildBlackList

func BuildBlackList(param ...string) (bl map[string]struct{})

BuildBlackList function

func Close

func Close()

Close shutdown and stops the core

func Hash

func Hash(v []byte) (h string)

Hash function

func Init

func Init(path string)

Init initializes core structures

func WrapCtxSend

func WrapCtxSend(ctx context.Context, evtChan chan<- []byte, event []byte) (ok bool)

WrapCtxSend send a given []byte event in a select with the given context

Types

type Blacklist

type Blacklist map[string]struct{}

Blacklist type

func (Blacklist) Add

func (b Blacklist) Add(key string)

Add blackilists a given key

type Collector

type Collector struct {
	Name     string
	GetData  GetDataFn
	EventOps *EventOps
	Joins    []*Join
	PostOps  PostEventOpsFn
}

Collector implements the base collector and main routines

func (*Collector) Start

func (c *Collector) Start(ctx *Context, writeCh chan<- []byte)

Start this collector with given ctxion and write channel

type Context

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

Context for running collectors and childrens wraps a context.Context for cancelation

func NewContext

func NewContext(ctx context.Context, name string, node *Node, store storage.Store, ttl time.Duration) (c *Context, err error)

NewContext creates a new session

func (*Context) Context

func (c *Context) Context() context.Context

Context returns this session context

func (*Context) CurrentRunTime

func (c *Context) CurrentRunTime() time.Time

CurrentRunTime returns the last time this session successfully ran

func (*Context) Delete

func (c *Context) Delete(key []byte) (err error)

Delete the given key

func (*Context) DeleteTree

func (c *Context) DeleteTree(prefix []byte) (err error)

DeleteTree for the given prefix

func (*Context) Get

func (c *Context) Get(key []byte) (value []byte, err error)

Get value for the given key

func (*Context) GetTree

func (c *Context) GetTree(prefix []byte) (entries []storage.Entry, err error)

GetTree for the given prefix

func (*Context) LastRunTime

func (c *Context) LastRunTime() time.Time

LastRunTime returns the last time this session successfully ran

func (*Context) LogDebug

func (c *Context) LogDebug(message string, keysAndValues ...interface{})

LogDebug the given string format with given arguments

func (*Context) LogError

func (c *Context) LogError(message string, keysAndValues ...interface{})

LogError the given string format with given arguments

func (*Context) LogInfo

func (c *Context) LogInfo(message string, keysAndValues ...interface{})

LogInfo the given string format with given arguments

func (*Context) LogWarn

func (c *Context) LogWarn(message string, keysAndValues ...interface{})

LogWarn the given string format with given arguments

func (*Context) Name

func (c *Context) Name() string

Name returns this session name

func (*Context) Node

func (c *Context) Node() *Node

Node returns this session node

func (*Context) Set

func (c *Context) Set(key, value []byte) (err error)

Set value for the given key

func (*Context) SetWithTTL

func (c *Context) SetWithTTL(key, value []byte, ttl time.Duration) (err error)

SetWithTTL value for the given key

func (*Context) Timeout

func (c *Context) Timeout() time.Duration

Timeout returns the session configured timeout

type DeltaOps

type DeltaOps struct {
	KeyField      string        // Field to use as unique key
	Rate          bool          // Wetheter or not to do rate calculations over time delta
	TTL           time.Duration // TTL of cached data
	Blacklist     Blacklist     // Fields to ignore in delta, can be nil
	RateBlacklist Blacklist     // Fields to exclude from rate calculations, can be nil
}

DeltaOps type

type EventOps

type EventOps struct {
	Round        int               // The precision for float fields
	FieldTypes   []*rexon.Value    // The Fields:Type for conversion
	FieldRenames map[string]string // The Fields:Name for renaming
	Delta        *DeltaOps
}

EventOps type

type GetDataFn

type GetDataFn func(ctx *Context) (events <-chan []byte)

GetDataFn collect function type

type Join

type Join struct {
	Name          string        // Collector name eg. `/aix/config/lvm`
	TTL           time.Duration // TTL when using cache
	JoinFields    []string      // Field names for possible matches to join, it will successfully return on first match
	JoinOnFields  []string      // Field name from the events of called Collector to join on
	IncludeFields []string      // Fields to include from the events of called collector
}

Join type

func (*Join) Process

func (j *Join) Process(ctx *Context, event []byte) (joined []byte, ok bool)

Process joins for the given event

type Node

type Node struct {
	HostName    string            `json:"hostname,omitempty"`
	NetAddr     string            `json:"netaddr,omitempty"`
	Type        string            `json:"type,omitempty"`
	SSHPort     string            `json:"ssh_port,omitempty"`
	SSHUser     string            `json:"ssh_user,omitempty"`
	SSHPassword string            `json:"ssh_password,omitempty"`
	SSHKey      []byte            `json:"ssh_key,omitempty"`
	APIURL      string            `json:"api_url,omitempty"`
	APIUser     string            `json:"api_user,omitempty"`
	APIPassword string            `json:"api_password,omitempty"`
	DBUser      string            `json:"db_user,omitempty"`
	DBPassword  string            `json:"db_password,omitempty"`
	DBPort      string            `json:"db_port,omitempty"`
	LogFiles    map[string]string `json:"files,omitempty"`
}

Node holds configuration for the given session

type PostEventOpsFn

type PostEventOpsFn func([]byte) (out []byte, err error)

PostEventOpsFn to post process events

Directories

Path Synopsis
cmd
collector
aix
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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