gstashs

package
v0.0.0-...-395a5c9 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Package gstashs defines multiple back-end service used to persistent store iam analytics data.

Index

Constants

View Source
const (
	KiB = 1 << (10 * iota)
	MiB
	GiB
	TiB
)

Define unit constant.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyTransport

type APIKeyTransport struct {
	APIKey   string
	APIKeyID string
}

APIKeyTransport defiens elasticsearch api key.

func (*APIKeyTransport) RoundTrip

func (t *APIKeyTransport) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip for APIKeyTransport auth.

type BaseMongoConf

type BaseMongoConf struct {
	MongoURL                      string    `json:"mongo_url"                         mapstructure:"mongo_url"`
	MongoUseSSL                   bool      `json:"mongo_use_ssl"                     mapstructure:"mongo_use_ssl"`
	MongoSSLInsecureSkipVerify    bool      `json:"mongo_ssl_insecure_skip_verify"    mapstructure:"mongo_ssl_insecure_skip_verify"`
	MongoSSLAllowInvalidHostnames bool      `json:"mongo_ssl_allow_invalid_hostnames" mapstructure:"mongo_ssl_allow_invalid_hostnames"`
	MongoSSLCAFile                string    `json:"mongo_ssl_ca_file"                 mapstructure:"mongo_ssl_ca_file"`
	MongoSSLPEMKeyfile            string    `json:"mongo_ssl_pem_keyfile"             mapstructure:"mongo_ssl_pem_keyfile"`
	MongoDBType                   MongoType `json:"mongo_db_type"                     mapstructure:"mongo_db_type"`
}

BaseMongoConf defines options needed when connnect to mongo db.

type CSVConf

type CSVConf struct {
	// Specify the directory used to store automatically generated csv file which contains analyzed data.
	CSVDir string `mapstructure:"csv_dir"`
}

CSVConf defines csv specific options.

type CSVGstash

type CSVGstash struct {
	CommonGstashConfig
	// contains filtered or unexported fields
}

CSVGstash defines a csv gstash with csv specific options and common options.

func (*CSVGstash) GetName

func (c *CSVGstash) GetName() string

GetName returns the csv gstash name.

func (*CSVGstash) Init

func (c *CSVGstash) Init(conf interface{}) error

Init initialize the csv gstash instance.

func (*CSVGstash) New

func (c *CSVGstash) New() Gstash

New create a csv gstash instance.

func (*CSVGstash) WriteData

func (c *CSVGstash) WriteData(ctx context.Context, data []interface{}) error

WriteData write analyzed data to csv persistent back-end storage.

type CommonGstashConfig

type CommonGstashConfig struct {
	OmitDetailedRecording bool
	// contains filtered or unexported fields
}

CommonGstashConfig defines common options used by all persistent store, like elasticsearch, kafka, mongo and etc.

func (*CommonGstashConfig) GetFilters

GetFilters get attributes `filters` for CommonGstashConfig.

func (*CommonGstashConfig) GetOmitDetailedRecording

func (p *CommonGstashConfig) GetOmitDetailedRecording() bool

GetOmitDetailedRecording get attributes `OmitDetailedRecording` for CommonGstashConfig.

func (*CommonGstashConfig) GetTimeout

func (p *CommonGstashConfig) GetTimeout() int

GetTimeout get attributes `timeout` for CommonGstashConfig.

func (*CommonGstashConfig) SetFilters

func (p *CommonGstashConfig) SetFilters(filters analytics.AnalyticsFilters)

SetFilters set attributes `filters` for CommonGstashConfig.

func (*CommonGstashConfig) SetOmitDetailedRecording

func (p *CommonGstashConfig) SetOmitDetailedRecording(omitDetailedRecording bool)

SetOmitDetailedRecording set attributes `OmitDetailedRecording` for CommonGstashConfig.

func (*CommonGstashConfig) SetTimeout

func (p *CommonGstashConfig) SetTimeout(timeout int)

SetTimeout set attributes `timeout` for CommonGstashConfig.

type DummyGstash

type DummyGstash struct {
	CommonGstashConfig
}

DummyGstash defines a dummy gstash with dummy specific options and common options.

func (*DummyGstash) GetName

func (p *DummyGstash) GetName() string

GetName returns the dummy gstash name.

func (*DummyGstash) Init

func (p *DummyGstash) Init(conf interface{}) error

Init initialize the dummy gstash instance.

func (*DummyGstash) New

func (p *DummyGstash) New() Gstash

New create a dummy gstash instance.

func (*DummyGstash) WriteData

func (p *DummyGstash) WriteData(ctx context.Context, data []interface{}) error

WriteData write analyzed data to dummy persistent back-end storage.

type Elasticsearch7Operator

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

Elasticsearch7Operator defines elasticsearch6 operator.

type ElasticsearchBulkConfig

type ElasticsearchBulkConfig struct {
	Workers       int `mapstructure:"workers"`
	FlushInterval int `mapstructure:"flush_interval"`
	BulkActions   int `mapstructure:"bulk_actions"`
	BulkSize      int `mapstructure:"bulk_size"`
}

ElasticsearchBulkConfig defines elasticsearch bulk config.

type ElasticsearchConf

type ElasticsearchConf struct {
	BulkConfig       ElasticsearchBulkConfig `mapstructure:"bulk_config"`
	IndexName        string                  `mapstructure:"index_name"`
	ElasticsearchURL string                  `mapstructure:"elasticsearch_url"`
	DocumentType     string                  `mapstructure:"document_type"`
	AuthAPIKeyID     string                  `mapstructure:"auth_api_key_id"`
	AuthAPIKey       string                  `mapstructure:"auth_api_key"`
	Username         string                  `mapstructure:"auth_basic_username"`
	Password         string                  `mapstructure:"auth_basic_password"`
	EnableSniffing   bool                    `mapstructure:"use_sniffing"`
	RollingIndex     bool                    `mapstructure:"rolling_index"`
	DisableBulk      bool                    `mapstructure:"disable_bulk"`
}

ElasticsearchConf defines elasticsearch specific options.

type ElasticsearchGstash

type ElasticsearchGstash struct {
	CommonGstashConfig
	// contains filtered or unexported fields
}

ElasticsearchGstash defines a elasticsearch gstash with elasticsearch specific options and common options.

func (*ElasticsearchGstash) GetName

func (e *ElasticsearchGstash) GetName() string

GetName returns the elasticsearch gstash name.

func (*ElasticsearchGstash) Init

func (e *ElasticsearchGstash) Init(config interface{}) error

Init initialize the elasticsearch gstash instance.

func (*ElasticsearchGstash) New

func (e *ElasticsearchGstash) New() Gstash

New create a elasticsearch gstash instance.

func (*ElasticsearchGstash) WriteData

func (e *ElasticsearchGstash) WriteData(ctx context.Context, data []interface{}) error

WriteData write analyzed data to elasticsearch persistent back-end storage.

type ElasticsearchOperator

type ElasticsearchOperator interface {
	// contains filtered or unexported methods
}

ElasticsearchOperator defines interface for all elasticsearch operator.

type Gstash

type Gstash interface {
	GetName() string
	New() Gstash
	Init(interface{}) error
	WriteData(context.Context, []interface{}) error
	SetFilters(analytics.AnalyticsFilters)
	GetFilters() analytics.AnalyticsFilters
	SetTimeout(timeout int)
	GetTimeout() int
	SetOmitDetailedRecording(bool)
	GetOmitDetailedRecording() bool
}

Gstash defines the interface for all analytics back-end.

func GetGstashByName

func GetGstashByName(name string) (Gstash, error)

GetGstashByName returns the gstash instance by given name.

type KafkaConf

type KafkaConf struct {
	Broker                []string          `mapstructure:"broker"`
	ClientID              string            `mapstructure:"client_id"`
	Topic                 string            `mapstructure:"topic"`
	SSLCertFile           string            `mapstructure:"ssl_cert_file"`
	SSLKeyFile            string            `mapstructure:"ssl_key_file"`
	SASLMechanism         string            `mapstructure:"sasl_mechanism"`
	Username              string            `mapstructure:"sasl_username"`
	Password              string            `mapstructure:"sasl_password"`
	Algorithm             string            `mapstructure:"sasl_algorithm"`
	Timeout               time.Duration     `mapstructure:"timeout"`
	MetaData              map[string]string `mapstructure:"meta_data"`
	Compressed            bool              `mapstructure:"compressed"`
	UseSSL                bool              `mapstructure:"use_ssl"`
	SSLInsecureSkipVerify bool              `mapstructure:"ssl_insecure_skip_verify"`
}

KafkaConf defines kafka specific options.

type KafkaGstash

type KafkaGstash struct {
	CommonGstashConfig
	// contains filtered or unexported fields
}

KafkaGstash defines a kafka gstash with kafka specific options and common options.

func (*KafkaGstash) GetName

func (k *KafkaGstash) GetName() string

GetName returns the kafka gstash name.

func (*KafkaGstash) Init

func (k *KafkaGstash) Init(config interface{}) error

Init initialize the kafka gstash instance.

func (*KafkaGstash) New

func (k *KafkaGstash) New() Gstash

New create a kafka gstash instance.

func (*KafkaGstash) WriteData

func (k *KafkaGstash) WriteData(ctx context.Context, data []interface{}) error

WriteData write analyzed data to kafka persistent back-end storage.

type Message

type Message map[string]interface{}

Message contains the messages need to push to gstash.

type MongoConf

type MongoConf struct {
	BaseMongoConf

	CollectionName            string `json:"collection_name"               mapstructure:"collection_name"`
	MaxInsertBatchSizeBytes   int    `json:"max_insert_batch_size_bytes"   mapstructure:"max_insert_batch_size_bytes"`
	MaxDocumentSizeBytes      int    `json:"max_document_size_bytes"       mapstructure:"max_document_size_bytes"`
	CollectionCapMaxSizeBytes int    `json:"collection_cap_max_size_bytes" mapstructure:"collection_cap_max_size_bytes"`
	CollectionCapEnable       bool   `json:"collection_cap_enable"         mapstructure:"collection_cap_enable"`
}

MongoConf defines mongo specific options.

type MongoGstash

type MongoGstash struct {
	CommonGstashConfig
	// contains filtered or unexported fields
}

MongoGstash defines a mongo gstash with mongo specific options and common options.

func (*MongoGstash) AccumulateSet

func (m *MongoGstash) AccumulateSet(data []interface{}) [][]interface{}

AccumulateSet accumulate data.

func (*MongoGstash) GetName

func (m *MongoGstash) GetName() string

GetName returns the mongo gstash name.

func (*MongoGstash) Init

func (m *MongoGstash) Init(config interface{}) error

Init initialize the mongo gstash instance.

func (*MongoGstash) New

func (m *MongoGstash) New() Gstash

New create a mongo gstash instance.

func (*MongoGstash) WriteData

func (m *MongoGstash) WriteData(ctx context.Context, data []interface{}) error

WriteData write analyzed data to mongo persistent back-end storage.

type MongoType

type MongoType int

MongoType define a new mongo type.

const (
	StandardMongo MongoType = iota
	AWSDocumentDB
)

Defines mongo type.

type PrometheusConf

type PrometheusConf struct {
	Addr string `mapstructure:"listen_address"`
	Path string `mapstructure:"path"`
}

PrometheusConf defines prometheus specific options.

type PrometheusGstash

type PrometheusGstash struct {

	// Per service
	TotalStatusMetrics *prometheus.CounterVec

	CommonGstashConfig
	// contains filtered or unexported fields
}

PrometheusGstash defines a prometheus gstash with prometheus specific options and common options.

func (*PrometheusGstash) GetName

func (p *PrometheusGstash) GetName() string

GetName returns the prometheus gstash name.

func (*PrometheusGstash) Init

func (p *PrometheusGstash) Init(conf interface{}) error

Init initialize the prometheus gstash instance.

func (*PrometheusGstash) New

func (p *PrometheusGstash) New() Gstash

New create a prometheus gstash instance.

func (*PrometheusGstash) WriteData

func (p *PrometheusGstash) WriteData(ctx context.Context, data []interface{}) error

WriteData write analyzed data to prometheus persistent back-end storage.

type SyslogConf

type SyslogConf struct {
	Transport   string `mapstructure:"transport"`
	NetworkAddr string `mapstructure:"network_addr"`
	LogLevel    int    `mapstructure:"log_level"`
	Tag         string `mapstructure:"tag"`
}

SyslogConf defines syslog specific options.

type SyslogGstash

type SyslogGstash struct {
	CommonGstashConfig
	// contains filtered or unexported fields
}

SyslogGstash defines a syslog gstash with syslog specific options and common options.

func (*SyslogGstash) GetFilters

func (s *SyslogGstash) GetFilters() analytics.AnalyticsFilters

GetFilters get attributes `filters` for SyslogGstash.

func (*SyslogGstash) GetName

func (s *SyslogGstash) GetName() string

GetName returns the syslog gstash name.

func (*SyslogGstash) GetTimeout

func (s *SyslogGstash) GetTimeout() int

GetTimeout get attributes `timeout` for SyslogGstash.

func (*SyslogGstash) Init

func (s *SyslogGstash) Init(config interface{}) error

Init initialize the syslog gstash instance.

func (*SyslogGstash) New

func (s *SyslogGstash) New() Gstash

New create a syslog gstash instance.

func (*SyslogGstash) SetFilters

func (s *SyslogGstash) SetFilters(filters analytics.AnalyticsFilters)

SetFilters set attributes `filters` for SyslogGstash.

func (*SyslogGstash) SetTimeout

func (s *SyslogGstash) SetTimeout(timeout int)

SetTimeout set attributes `timeout` for SyslogGstash.

func (*SyslogGstash) WriteData

func (s *SyslogGstash) WriteData(ctx context.Context, data []interface{}) error

WriteData write analyzed data to syslog persistent back-end storage.

Jump to

Keyboard shortcuts

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