graylog

package module
v2.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 25, 2019 License: MIT Imports: 9 Imported by: 36

README

go-graylog

GoDoc Build Status codecov Go Report Card GitHub last commit GitHub tag License

Graylog API client and mock server for Golang and terraform provider for Graylog.

Supported APIs

Graylog provides very various APIs so we can't support all of them yet. Please check the following godoc's Client methods.

https://godoc.org/github.com/suzuki-shunsuke/go-graylog/client

Example - client and mock server

Mock Server CLI tool

Download a binary from the release page.

$ graylog-mock-server --help
graylog-mock-server - Run Graylog mock server.

USAGE:
   graylog-mock-server [options]

VERSION:
   0.1.0

OPTIONS:
   --port value       port number. If you don't set this option, a free port is assigned and the assigned port number is outputed to the console when the mock server runs.
   --log-level value  the log level of logrus which the mock server uses internally. (default: "info")
   --data value       data file path. When the server runs data of the file is loaded and when data of the server is changed data is saved at the file. If this option is not set, no data is loaded and saved.
   --help, -h         show help
   --version, -v      print the version

Terraform provider

Supported Graylog version

We support the following versions.

  • v2.5
  • v3

We use the graylog's official Docker Image for development.

Support of Graylog v3

Use client.NewClientV3 instead of client.NewClient .

In the terraform provider, please set the variable api_version to v3.

Contribution

See CONTRIBUTING.md .

See also

License

MIT

Documentation

Overview

Package graylog provides Golang's structs which represents Graylog resource such as roles and users. Client and mock server and terraform provider are provided as subpackages.

https://godoc.org/github.com/suzuki-shunsuke/go-graylog/#pkg-subdirectories

Index

Constants

View Source
const (
	// EmailAlarmCallbackType is a type of EmailAlarmCallback.
	EmailAlarmCallbackType = "org.graylog2.alarmcallbacks.EmailAlarmCallback"
	// HTTPAlarmCallbackType is a type of HTTPAlarmCallback.
	HTTPAlarmCallbackType = "org.graylog2.alarmcallbacks.HTTPAlarmCallback"
	// SlackAlarmCallbackType is a type of SlackAlarmCallback.
	SlackAlarmCallbackType = "org.graylog2.plugins.slack.callback.SlackAlarmCallback"
)
View Source
const (
	// MessageCountRotationStrategy is one of index set's rotation strategies.
	MessageCountRotationStrategy string = "org.graylog2.indexer.rotation.strategies.MessageCountRotationStrategy"
	// SizeBasedRotationStrategy is one of index set's rotation strategies.
	SizeBasedRotationStrategy string = "org.graylog2.indexer.rotation.strategies.SizeBasedRotationStrategy"
	// TimeBasedRotationStrategy is one of index set's rotation strategies.
	TimeBasedRotationStrategy string = "org.graylog2.indexer.rotation.strategies.TimeBasedRotationStrategy"
	// MessageCountRotationStrategyConfig is one of index set's rotation strategy configs.
	MessageCountRotationStrategyConfig string = "org.graylog2.indexer.rotation.strategies.MessageCountRotationStrategyConfig"
	// SizeBasedRotationStrategyConfig is one of index set's rotation strategy configs.
	SizeBasedRotationStrategyConfig string = "org.graylog2.indexer.rotation.strategies.SizeBasedRotationStrategyConfig"
	// TimeBasedRotationStrategyConfig is one of index set's rotation strategy configs.
	TimeBasedRotationStrategyConfig string = "org.graylog2.indexer.rotation.strategies.TimeBasedRotationStrategyConfig"
	// DeletionRetentionStrategy is one of index set's retention strategies.
	DeletionRetentionStrategy string = "org.graylog2.indexer.retention.strategies.DeletionRetentionStrategy"
	// ClosingRetentionStrategy is one of index set's retention strategies.
	ClosingRetentionStrategy string = "org.graylog2.indexer.retention.strategies.ClosingRetentionStrategy"
	// NoopRetentionStrategy is one of index set's retention strategies.
	NoopRetentionStrategy string = "org.graylog2.indexer.retention.strategies.NoopRetentionStrategy"
	// DeletionRetentionStrategyConfig is one of index set's retention strategy configs.
	DeletionRetentionStrategyConfig string = "org.graylog2.indexer.retention.strategies.DeletionRetentionStrategyConfig"
	// ClosingRetentionStrategyConfig is one of index set's retention strategy configs.
	ClosingRetentionStrategyConfig string = "org.graylog2.indexer.retention.strategies.ClosingRetentionStrategyConfig"
	// NoopRetentionStrategyConfig is one of index set's retention strategy configs.
	NoopRetentionStrategyConfig string = "org.graylog2.indexer.retention.strategies.NoopRetentionStrategyConfig"
	// CreationDateFormat is the date format used at graylog API's request and response body.
	CreationDateFormat string = "2006-01-02T15:04:05.000Z"
)
View Source
const (
	// InputTypeAWSCloudTrail is one of input types.
	InputTypeAWSCloudTrail string = "org.graylog.aws.inputs.cloudtrail.CloudTrailInput"
)
View Source
const (
	// InputTypeAWSCloudWatchLogs is one of input types.
	InputTypeAWSCloudWatchLogs string = "org.graylog.aws.inputs.cloudwatch.CloudWatchLogsInput"
)
View Source
const (
	// InputTypeAWSFlowLogs is one of input types.
	InputTypeAWSFlowLogs string = "org.graylog.aws.inputs.flowlogs.FlowLogsInput"
)
View Source
const (
	// InputTypeBeats is one of input types.
	InputTypeBeats string = "org.graylog.plugins.beats.BeatsInput"
)
View Source
const (
	// InputTypeCEFAMQP is one of input types.
	InputTypeCEFAMQP string = "org.graylog.plugins.cef.input.CEFAmqpInput"
)
View Source
const (
	// InputTypeCEFKafka is one of input types.
	InputTypeCEFKafka string = "org.graylog.plugins.cef.input.CEFKafkaInput"
)
View Source
const (
	// InputTypeCEFTCP is one of input types.
	InputTypeCEFTCP string = "org.graylog.plugins.cef.input.CEFTCPInput"
)
View Source
const (
	// InputTypeCEFUDP is one of input types.
	InputTypeCEFUDP string = "org.graylog.plugins.cef.input.CEFUDPInput"
)
View Source
const (
	// InputTypeFakeHTTPMessage is one of input types.
	InputTypeFakeHTTPMessage string = "org.graylog2.inputs.random.FakeHttpMessageInput"
)
View Source
const (
	// InputTypeGELFAMQP is one of input types.
	InputTypeGELFAMQP string = "org.graylog2.inputs.gelf.amqp.GELFAMQPInput"
)
View Source
const (
	// InputTypeGELFHTTP is one of input types.
	InputTypeGELFHTTP string = "org.graylog2.inputs.gelf.http.GELFHttpInput"
)
View Source
const (
	// InputTypeGELFKafka is one of input types.
	InputTypeGELFKafka string = "org.graylog2.inputs.gelf.kafka.GELFKafkaInput"
)
View Source
const (
	// InputTypeGELFTCP is one of input types.
	InputTypeGELFTCP string = "org.graylog2.inputs.gelf.tcp.GELFTCPInput"
)
View Source
const (
	// InputTypeGELFUDP is one of input types.
	InputTypeGELFUDP string = "org.graylog2.inputs.gelf.udp.GELFUDPInput"
)
View Source
const (
	// InputTypeJSONPath is one of input types.
	InputTypeJSONPath string = "org.graylog2.inputs.misc.jsonpath.JsonPathInput"
)
View Source
const (
	// InputTypeNetFlowUDP is one of input types.
	InputTypeNetFlowUDP string = "org.graylog.plugins.netflow.inputs.NetFlowUdpInput"
)
View Source
const (
	// InputTypeRawAMQP is one of input types.
	InputTypeRawAMQP string = "org.graylog2.inputs.raw.amqp.RawAMQPInput"
)
View Source
const (
	// InputTypeRawKafka is one of input types.
	InputTypeRawKafka string = "org.graylog2.inputs.raw.kafka.RawKafkaInput"
)
View Source
const (
	// InputTypeSyslogAMQP is one of input types.
	InputTypeSyslogAMQP string = "org.graylog2.inputs.syslog.amqp.SyslogAMQPInput"
)
View Source
const (
	// InputTypeSyslogKafka is one of input types.
	InputTypeSyslogKafka string = "org.graylog2.inputs.syslog.kafka.SyslogKafkaInput"
)
View Source
const (
	// InputTypeSyslogTCP is one of input types.
	InputTypeSyslogTCP string = "org.graylog2.inputs.syslog.tcp.SyslogTCPInput"
)
View Source
const (
	// InputTypeSyslogUDP is one of input types.
	InputTypeSyslogUDP string = "org.graylog2.inputs.syslog.udp.SyslogUDPInput"
)
View Source
const Version = "2.5.0"

Version is the go-graylog's version.

Variables

View Source
var (
	// InputAttrsIntFieldSet is the set of int fields of all type of input attributes.
	InputAttrsIntFieldSet = set.NewStrSet()
	// InputAttrsBoolFieldSet is the set of bool fields of all type of input attributes.
	InputAttrsBoolFieldSet = set.NewStrSet()
	// InputAttrsStrFieldSet is the set of string fields of all type of input attributes.
	InputAttrsStrFieldSet = set.NewStrSet()
)

Functions

func SetFuncGetInputAttrsByType

func SetFuncGetInputAttrsByType(f GetInputAttrsByTypeIntf)

SetFuncGetInputAttrsByType customizes NewInputAttrsByType's behavior.

func SetFuncGetUnknownTypeInputAttrs

func SetFuncGetUnknownTypeInputAttrs(f GetUnknownTypeInputAttrsIntf)

SetFuncGetUnknownTypeInputAttrs customizes NewInputAttrsByType's behavior.

func SetInputAttrs

func SetInputAttrs(args ...NewInputAttrs) error

SetInputAttrs sets InputAttrs. You can add the custom InputAttrs and override existing InputAttrs.

Types

type AlarmCallback added in v0.5.0

type AlarmCallback struct {
	// ex. "org.graylog2.alarmcallbacks.HTTPAlarmCallback"
	ID            string                     `json:"id,omitempty" v-create:"isdefault"`
	StreamID      string                     `json:"stream_id,omitempty" v-create:"required"`
	Title         string                     `json:"title" v-create:"required"`
	CreatorUserID string                     `json:"creator_user_id,omitempty" v-create:"isdefault"`
	CreatedAt     string                     `json:"created_at,omitempty" v-create:"isdefault"`
	Configuration AlarmCallbackConfiguration `json:"configuration" v-create:"required"`
}

AlarmCallback represents an Alarm Callback. http://docs.graylog.org/en/latest/pages/streams/alerts.html#alert-notifications-types-explained

func (*AlarmCallback) MarshalJSON added in v1.1.0

func (ac *AlarmCallback) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON encoding of an AlarmCallback.

func (AlarmCallback) Type added in v1.1.0

func (ac AlarmCallback) Type() string

Type returns an alarm callback type.

func (*AlarmCallback) UnmarshalJSON added in v1.1.0

func (ac *AlarmCallback) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals JSON into an AlarmCallback.

type AlarmCallbackConfiguration added in v1.1.0

type AlarmCallbackConfiguration interface {
	AlarmCallbackType() string
}

AlarmCallbackConfiguration is an alarm callback configuration.

type AlarmCallbacksBody added in v0.5.0

type AlarmCallbacksBody struct {
	AlarmCallbacks []AlarmCallback `json:"alarmcallbacks"`
	Total          int             `json:"total"`
}

AlarmCallbacksBody represents Get Alarm Callbacks API's response body. Basically users don't use this struct, but this struct is public because some sub packages use this struct.

type Alert added in v0.2.0

type Alert struct {
	ID                  string                    `json:"id"`
	Description         string                    `json:"description"`
	ConditionID         string                    `json:"condition_id"`
	StreamID            string                    `json:"stream_id"`
	TriggeredAt         string                    `json:"triggered_at"`
	ResolvedAt          string                    `json:"resolved_at"`
	IsInterval          bool                      `json:"is_interval"`
	ConditionParameters *AlertConditionParameters `json:"condition_parameters"`
}

Alert represents an Alert. http://docs.graylog.org/en/2.4/pages/streams/alerts.html

type AlertCondition

type AlertCondition struct {
	ID            string                   `json:"id,omitempty"`
	CreatorUserID string                   `json:"creator_user_id,omitempty"`
	CreatedAt     string                   `json:"created_at,omitempty"`
	Title         string                   `json:"title" v-create:"required" v-update:"required"`
	InGrace       bool                     `json:"in_grace,omitempty"`
	Parameters    AlertConditionParameters `json:"parameters" v-create:"reqired" v-update:"required"`
}

AlertCondition represents an Alert Condition. http://docs.graylog.org/en/2.4/pages/streams/alerts.html#conditions

func (*AlertCondition) MarshalJSON added in v1.0.0

func (cond *AlertCondition) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON encoding of an alert condition.

func (AlertCondition) Type added in v0.2.0

func (cond AlertCondition) Type() string

Type returns an alert condition type.

func (*AlertCondition) UnmarshalJSON added in v1.0.0

func (cond *AlertCondition) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals JSON into an alert condition.

type AlertConditionParameters added in v0.2.0

type AlertConditionParameters interface {
	AlertConditionType() string
}

AlertConditionParameters represents Alert Condition's parameters.

type AlertConditionsBody added in v0.2.0

type AlertConditionsBody struct {
	AlertConditions []AlertCondition `json:"conditions"`
	Total           int              `json:"total"`
}

AlertConditionsBody represents Get Alert Conditions API's response body. Basically users don't use this struct, but this struct is public because some sub packages use this struct.

type AlertReceivers

type AlertReceivers struct {
	Emails []string `json:"emails,omitempty"`
	Users  []string `json:"users,omitempty"`
}

AlertReceivers represents alert receivers.

type AlertsBody added in v0.2.0

type AlertsBody struct {
	Alerts []Alert `json:"alerts"`
	Total  int     `json:"total"`
}

AlertsBody represents Get Alerts API's response body. Basically users don't use this struct, but this struct is public because some sub packages use this struct.

type CollectorConfiguration added in v0.7.0

type CollectorConfiguration struct {
	ID       string                          `json:"id,omitempty" v-create:"isdefault"`
	Name     string                          `json:"name,omitempty" v-create:"required"`
	Tags     set.StrSet                      `json:"tags"`
	Inputs   []CollectorConfigurationInput   `json:"inputs"`
	Outputs  []CollectorConfigurationOutput  `json:"outputs"`
	Snippets []CollectorConfigurationSnippet `json:"snippets"`
}

CollectorConfiguration represents a Graylog's Collector Configuration.

type CollectorConfigurationInput added in v0.7.0

type CollectorConfigurationInput struct {
	Backend    string                              `json:"backend"`
	Type       string                              `json:"type"`
	Name       string                              `json:"name"`
	InputID    string                              `json:"input_id"`
	ForwardTo  string                              `json:"forward_to"`
	Properties CollectorConfigurationInputProperty `json:"properties"`
}

CollectorConfigurationInput represents a Graylog's Collector Configuration Input.

type CollectorConfigurationInputFileProperty added in v0.7.0

type CollectorConfigurationInputFileProperty struct {
	Paths         string `json:"paths"`
	ExcludeFiles  string `json:"exclude_files"`
	ScanFrequency string `json:"scan_frequency"`
	Encoding      string `json:"encoding"`
	IgnoreOlder   string `json:"ignore_older"`
	DocumentType  string `json:"document_type"`
	ExcludeLines  string `json:"exclude_lines"`
	IncludeLines  string `json:"include_lines"`
	TailFiles     bool   `json:"tail_files"`
}

CollectorConfigurationInputFileProperty represents a Graylog's Collector Configuration file type Input properties.

type CollectorConfigurationInputProperty added in v0.7.0

type CollectorConfigurationInputProperty interface{}

CollectorConfigurationInputProperty represents a Graylog's Collector Configuration Input properties.

type CollectorConfigurationInputWindowsEventLogProperty added in v0.7.0

type CollectorConfigurationInputWindowsEventLogProperty struct {
	Event string `json:"event"`
}

CollectorConfigurationInputWindowsEventLogProperty represents a Graylog's Collector Configuration windows event log type Input properties.

type CollectorConfigurationOutput added in v0.7.0

type CollectorConfigurationOutput struct {
	Backend    string                               `json:"backend"`
	Type       string                               `json:"type"`
	Name       string                               `json:"name"`
	OutputID   string                               `json:"output_id"`
	Properties CollectorConfigurationOutputProperty `json:"properties"`
}

CollectorConfigurationOutput represents a Graylog's Collector Configuration Output.

type CollectorConfigurationOutputProperty added in v0.7.0

type CollectorConfigurationOutputProperty interface{}

CollectorConfigurationOutputProperty represents a Graylog's Collector Configuration Output properties.

type CollectorConfigurationSnippet added in v0.7.0

type CollectorConfigurationSnippet struct {
	Backend   string `json:"backend"`
	Name      string `json:"name"`
	Snippet   string `json:"snippet"`
	SnippetID string `json:"snippet_id"`
}

CollectorConfigurationSnippet represents a Graylog's Collector Configuration Snippet.

type CollectorConfigurationsBody added in v0.7.0

type CollectorConfigurationsBody struct {
	Configurations []CollectorConfiguration `json:"configurations"`
	Total          int                      `json:"total"`
}

CollectorConfigurationsBody represents Get Collector Configurations API's response body. Basically users don't use this struct, but this struct is public because some sub packages use this struct.

type Dashboard added in v0.4.0

type Dashboard struct {
	// required
	Title       string `json:"title,omitempty" v-create:"required"`
	Description string `json:"description,omitempty"`

	// ex. "2018-02-20T11:37:19.305Z"
	CreatedAt string `json:"created_at,omitempty"`
	ID        string `json:"id,omitempty" v-create:"isdefault"`
	// TODO support positions
	Widgets []Widget `json:"widgets,omitempty"`
}

Dashboard represents a Graylog's Dashboard. http://docs.graylog.org/en/latest/pages/dashboards.html

type DashboardsBody added in v0.4.0

type DashboardsBody struct {
	Dashboards []Dashboard `json:"dashboards"`
	Total      int         `json:"total"`
}

DashboardsBody represents Get Dashboards API's response body. Basically users don't use this struct, but this struct is public because some sub packages use this struct.

type EmailAlarmCallbackConfiguration added in v0.5.0

type EmailAlarmCallbackConfiguration struct {
	Sender         string     `json:"sender" v-create:"required"`
	Subject        string     `json:"subject" v-create:"required"`
	Body           string     `json:"body,omitempty"`
	UserReceivers  set.StrSet `json:"user_receivers,omitempty"`
	EmailReceivers set.StrSet `json:"email_receivers,omitempty"`
}

EmailAlarmCallbackConfiguration represents a configuration of EmailAlarmCallback.

func (*EmailAlarmCallbackConfiguration) AlarmCallbackType added in v1.1.0

func (ac *EmailAlarmCallbackConfiguration) AlarmCallbackType() string

AlarmCallbackType returns an alarm callback type.

type Extractor

type Extractor struct {
	ID                  string               `json:"id,omitempty"`
	Title               string               `json:"title,omitempty"`
	Type                string               `json:"type,omitempty"`
	Converters          []ExtractorConverter `json:"converters,omitempty"`
	Order               int                  `json:"order"`
	Exceptions          int                  `json:"exceptions,omitempty"`
	ConverterExceptions int                  `json:"converter_exceptions,omitempty"`
	Metrics             *ExtractorMetrics    `json:"metrics,omitempty"`
	CursorStrategy      string               `json:"cursor_strategy,omitempty"`
	SourceField         string               `json:"source_field,omitempty"`
	TargetField         string               `json:"target_field"`
	ExtractorConfig     interface{}          `json:"extractor_config,omitempty"`
	CreatorUserID       string               `json:"creator_user_id,omitempty"`
	ConditionType       string               `json:"condition_type,omitempty"`
	ConditionValue      string               `json:"condition_value"`
}

func (*Extractor) UnmarshalJSON

func (extractor *Extractor) UnmarshalJSON(b []byte) error

type ExtractorConverter

type ExtractorConverter struct {
	Type   string                    `json:"type"`
	Config *ExtractorConverterConfig `json:"config"`
}

type ExtractorConverterConfig

type ExtractorConverterConfig struct {
	DateFormat string `json:"date_format,omitempty"`
	TimeZone   string `json:"time_zone,omitempty"`
	Locale     string `json:"locale,omitempty"`
}

type ExtractorMetric

type ExtractorMetric struct {
	Time         *ExtractorMetricTime `json:"time,omitempty"`
	Rate         *ExtractorMetricRate `json:"rate,omitempty"`
	DurationUnit string               `json:"duration_unit,omitempty"`
	RateUnit     string               `json:"rate_unit,omitempty"`
}

type ExtractorMetricRate

type ExtractorMetricRate struct {
	// in Graylog, the type of these fields are double.
	// https://github.com/Graylog2/graylog2-server/blob/484fdf0940718cb6bf23f812d000fd07f165eb92/graylog2-server/src/main/java/org/graylog2/rest/models/metrics/responses/RateMetricsResponse.java#L25-L35
	Total         float64 `json:"total,omitempty"`
	Mean          float64 `json:"mean,omitempty"`
	OneMinute     float64 `json:"one_minute,omitempty"`
	FiveMinute    float64 `json:"five_minute,omitempty"`
	FifteenMinute float64 `json:"fifteen_minute,omitempty"`
}

type ExtractorMetricTime

type ExtractorMetricTime struct {
	// in Graylog, the type of these fields are double.
	// https://github.com/Graylog2/graylog2-server/blob/484fdf0940718cb6bf23f812d000fd07f165eb92/graylog2-server/src/main/java/org/graylog2/rest/models/metrics/responses/TimerMetricsResponse.java#L25-L39
	Min            float64 `json:"min,omitempty"`
	Max            float64 `json:"max,omitempty"`
	Mean           float64 `json:"mean,omitempty"`
	StdDev         float64 `json:"std_dev,omitempty"`
	Percentile95th float64 `json:"95th_percentile,omitempty"`
	Percentile98th float64 `json:"98th_percentile,omitempty"`
	Percentile99th float64 `json:"99th_percentile,omitempty"`
}

type ExtractorMetrics

type ExtractorMetrics struct {
	Total           *ExtractorMetric `json:"total,omitempty"`
	Condition       *ExtractorMetric `json:"condition,omitempty"`
	Execution       *ExtractorMetric `json:"execution,omitempty"`
	Converters      *ExtractorMetric `json:"converters,omitempty"`
	ConditionHits   int              `json:"condition_hits,omitempty"`
	ConditionMisses int              `json:"condition_misses,omitempty"`
}

type ExtractorTypeGrokConfig

type ExtractorTypeGrokConfig struct {
	GrokPattern string `json:"grok_pattern"`
}

type ExtractorTypeJSONConfig

type ExtractorTypeJSONConfig struct {
	ListSeparator            string `json:"list_separator,omitempty"`
	KVSeparator              string `json:"kv_separator,omitempty"`
	KeyPrefix                string `json:"key_prefix,omitempty"`
	KeySeparator             string `json:"key_separator,omitempty"`
	ReplaceKeyWhitespace     bool   `json:"replace_key_whitespace"`
	KeyWhitespaceReplacement string `json:"key_whitespace_replacement,omitempty"`
}

type ExtractorTypeRegexConfig

type ExtractorTypeRegexConfig struct {
	RegexValue string `json:"regex_value"`
}

type ExtractorsBody

type ExtractorsBody struct {
	Total      int         `json:"total"`
	Extractors []Extractor `json:"extractors"`
}

ExtractorsBody represents Get Extractors API's response body. Basically users don't use this struct, but this struct is public because some sub packages use this struct.

type FieldAggregationAlertConditionParameters added in v1.0.0

type FieldAggregationAlertConditionParameters struct {
	Grace               int    `json:"grace"`
	Backlog             int    `json:"backlog"`
	Threshold           int    `json:"threshold"`
	Time                int    `json:"time" v-create:"required"`
	RepeatNotifications bool   `json:"repeat_notifications,omitempty"`
	Field               string `json:"field,omitempty" v-create:"required"`
	Query               string `json:"query,omitempty"`
	ThresholdType       string `json:"threshold_type,omitempty" v-create:"required"`
	Type                string `json:"type,omitempty" v-create:"required"`
}

FieldAggregationAlertConditionParameters represents Field Aggregation Alert Condition's parameters.

func (FieldAggregationAlertConditionParameters) AlertConditionType added in v1.0.0

func (p FieldAggregationAlertConditionParameters) AlertConditionType() string

AlertConditionType returns an alert condition type.

type FieldContentAlertConditionParameters added in v1.0.0

type FieldContentAlertConditionParameters struct {
	Grace               int    `json:"grace"`
	Backlog             int    `json:"backlog"`
	RepeatNotifications bool   `json:"repeat_notifications,omitempty"`
	Field               string `json:"field,omitempty" v-create:"required"`
	Value               string `json:"value,omitempty" v-create:"required"`
	Query               string `json:"query,omitempty"`
}

FieldContentAlertConditionParameters represents Field Content Alert Condition's parameters.

func (FieldContentAlertConditionParameters) AlertConditionType added in v1.0.0

func (p FieldContentAlertConditionParameters) AlertConditionType() string

AlertConditionType returns an alert condition type.

type GeneralAlarmCallbackConfiguration added in v1.1.0

type GeneralAlarmCallbackConfiguration struct {
	Type          string                 `json:"type"`
	Configuration map[string]interface{} `json:"configuration"`
}

GeneralAlarmCallbackConfiguration is a general third party's AlarmCallbackConfiguration.

func (*GeneralAlarmCallbackConfiguration) AlarmCallbackType added in v1.1.0

func (p *GeneralAlarmCallbackConfiguration) AlarmCallbackType() string

AlarmCallbackType returns an alarm callback type.

func (*GeneralAlarmCallbackConfiguration) MarshalJSON added in v1.1.0

func (p *GeneralAlarmCallbackConfiguration) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON encoding of GeneralAlarmCallbackConfiguration.

type GeneralAlertConditionParameters added in v1.0.0

type GeneralAlertConditionParameters struct {
	Type       string
	Parameters map[string]interface{}
}

GeneralAlertConditionParameters is a general third party's alert condition parameters.

func (GeneralAlertConditionParameters) AlertConditionType added in v1.0.0

func (p GeneralAlertConditionParameters) AlertConditionType() string

AlertConditionType returns an alert condition type.

func (*GeneralAlertConditionParameters) MarshalJSON added in v1.0.0

func (p *GeneralAlertConditionParameters) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON encoding of GeneralAlertConditionParameters.

type GetInputAttrsByTypeIntf

type GetInputAttrsByTypeIntf func(map[string]NewInputAttrs, string) InputAttrs

GetInputAttrsByTypeIntf returns a given type InputAttrs.

func GetFuncGetInputAttrsByType

func GetFuncGetInputAttrsByType() GetInputAttrsByTypeIntf

GetFuncGetInputAttrsByType returns the global GetInputAttrsByType function. Mainly this is used to prevent global pollution at test.

f := graylog.GetFuncGetInputAttrsByType()
// change the global function temporary
defer graylog.SetFuncGetInputAttrsByType(f)
graylog.SetFuncGetInputAttrsByType(customFunc)

type GetUnknownTypeInputAttrsIntf

type GetUnknownTypeInputAttrsIntf func(map[string]NewInputAttrs, string) InputAttrs

GetUnknownTypeInputAttrsIntf returns an unknown type InputAttrs.

func GetFuncGetUnknownTypeInputAttrs

func GetFuncGetUnknownTypeInputAttrs() GetUnknownTypeInputAttrsIntf

GetFuncGetUnknownTypeInputAttrs returns the global GetUnknownTypeInputAttrs function. Mainly this is used to prevent global pollution at test.

f := graylog.GetFuncGetUnknownTypeInputAttrs()
// change the global function temporary
defer graylog.SetFuncGetUnknownTypeInputAttrs(f)
graylog.SetFuncGetUnknownTypeInputAttrs(customFunc)

type HTTPAlarmCallbackConfiguration added in v0.5.0

type HTTPAlarmCallbackConfiguration struct {
	URL string `json:"url" v-create:"required"`
}

HTTPAlarmCallbackConfiguration represents a configuration of HTTPAlarmCallback.

func (*HTTPAlarmCallbackConfiguration) AlarmCallbackType added in v1.1.0

func (ac *HTTPAlarmCallbackConfiguration) AlarmCallbackType() string

AlarmCallbackType returns an alarm callback type.

type IndexSet

type IndexSet struct {
	// required
	Title string `json:"title,omitempty" v-create:"required"`
	// ^[a-z0-9][a-z0-9_+-]*$
	IndexPrefix string `json:"index_prefix,omitempty" v-create:"required,indexprefixregexp"`
	// ex. "org.graylog2.indexer.rotation.strategies.MessageCountRotationStrategy"
	RotationStrategyClass string            `json:"rotation_strategy_class,omitempty" v-create:"required"`
	RotationStrategy      *RotationStrategy `json:"rotation_strategy,omitempty" v-create:"required"`
	// ex. "org.graylog2.indexer.retention.strategies.DeletionRetentionStrategy"
	RetentionStrategyClass string             `json:"retention_strategy_class,omitempty" v-create:"required"`
	RetentionStrategy      *RetentionStrategy `json:"retention_strategy,omitempty" v-create:"required"`
	// ex. "2018-02-20T11:37:19.305Z"
	CreationDate                    string `json:"creation_date,omitempty"`
	IndexAnalyzer                   string `json:"index_analyzer,omitempty" v-create:"required"`
	Shards                          int    `json:"shards,omitempty" v-create:"required"`
	IndexOptimizationMaxNumSegments int    `json:"index_optimization_max_num_segments,omitempty" v-create:"required"`
	// field_type_refresh_interval is added from Graylog API v3
	FieldTypeRefreshInterval int `json:"field_type_refresh_interval,omitempty"`

	ID string `json:"id,omitempty" v-create:"isdefault"`

	Description               string         `json:"description,omitempty"`
	Replicas                  int            `json:"replicas,omitempty"`
	IndexOptimizationDisabled bool           `json:"index_optimization_disabled,omitempty"`
	Writable                  bool           `json:"writable,omitempty"`
	Default                   bool           `json:"default,omitempty"`
	Stats                     *IndexSetStats `json:"-"`
}

IndexSet represents a Graylog's Index Set. http://docs.graylog.org/en/2.4/pages/configuration/index_model.html#index-set-configuration

func (*IndexSet) CreationTime

func (is *IndexSet) CreationTime() (time.Time, error)

CreationTime returns a creation date converted to time.Time.

func (*IndexSet) NewUpdateParams

func (is *IndexSet) NewUpdateParams() *IndexSetUpdateParams

NewUpdateParams converts an IndexSet to IndexSetUpdateParams.

func (*IndexSet) SetCreateDefaultValues

func (is *IndexSet) SetCreateDefaultValues()

SetCreateDefaultValues sets the default values of Create Index Set API.

func (*IndexSet) SetCreationTime

func (is *IndexSet) SetCreationTime(t time.Time)

SetCreationTime sets a creation date with time.Time.

type IndexSetStats

type IndexSetStats struct {
	Indices   int `json:"indices"`
	Documents int `json:"documents"`
	Size      int `json:"size"`
}

IndexSetStats represents a Graylog's Index Set Stats.

type IndexSetUpdateParams

type IndexSetUpdateParams struct {
	Title                           string             `json:"title" v-update:"required"`
	IndexPrefix                     string             `json:"index_prefix" v-update:"required,indexprefixregexp"`
	RotationStrategyClass           string             `json:"rotation_strategy_class" v-update:"required"`
	RotationStrategy                *RotationStrategy  `json:"rotation_strategy" v-update:"required"`
	RetentionStrategyClass          string             `json:"retention_strategy_class" v-update:"required"`
	RetentionStrategy               *RetentionStrategy `json:"retention_strategy" v-update:"required"`
	IndexAnalyzer                   string             `json:"index_analyzer" v-update:"required"`
	Shards                          int                `json:"shards" v-update:"required"`
	IndexOptimizationMaxNumSegments int                `json:"index_optimization_max_num_segments" v-update:"required"`
	// field_type_refresh_interval is added from Graylog API v3
	FieldTypeRefreshInterval int    `json:"field_type_refresh_interval"`
	ID                       string `json:"id" v-update:"required,objectid"`

	Description               *string `json:"description,omitempty"`
	Replicas                  *int    `json:"replicas,omitempty"`
	IndexOptimizationDisabled *bool   `json:"index_optimization_disabled,omitempty"`
	Writable                  *bool   `json:"writable,omitempty"`
}

IndexSetUpdateParams represents a Graylog's Index Set Update API's parameter. http://docs.graylog.org/en/2.4/pages/configuration/index_model.html#index-set-configuration

type IndexSetsBody

type IndexSetsBody struct {
	IndexSets []IndexSet               `json:"index_sets"`
	Stats     map[string]IndexSetStats `json:"stats"`
	Total     int                      `json:"total"`
}

IndexSetsBody represents Get Index Sets API's response body. Basically users don't use this struct, but this struct is public because some sub packages use this struct.

type Input

type Input struct {
	// Select a name of your new input that describes it.
	Title string `json:"title,omitempty" v-create:"required"`
	// https://github.com/Graylog2/graylog2-server/issues/3480
	// update input overwrite attributes
	Attrs InputAttrs `json:"attributes,omitempty" v-create:"required"`

	ID string `json:"id,omitempty" v-create:"isdefault"`

	// Should this input start on all nodes
	Global bool `json:"global,omitempty"`
	// On which node should this input start
	// ex. "2ad6b340-3e5f-4a96-ae81-040cfb8b6024"
	Node string `json:"node,omitempty"`
	// ex. 2018-02-24T03:02:26.001Z
	CreatedAt string `json:"created_at,omitempty" v-create:"isdefault"`
	// ex. "admin"
	CreatorUserID string `json:"creator_user_id,omitempty" v-create:"isdefault"`
}

Input represents Graylog Input.

func (*Input) MarshalJSON

func (input *Input) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the json.Marshaler interface.

func (*Input) NewUpdateParams

func (input *Input) NewUpdateParams() *InputUpdateParams

NewUpdateParams converts Input to InputUpdateParams.

func (*Input) ToData

func (input *Input) ToData() (*InputData, error)

ToData assigns input's data to InputData.

func (Input) Type

func (input Input) Type() string

Type returns the input's type.

func (*Input) UnmarshalJSON

func (input *Input) UnmarshalJSON(b []byte) error

UnmarshalJSON is the implementation of the json.Unmarshaler interface.

type InputAWSCloudTrailAttrs

type InputAWSCloudTrailAttrs struct {
	CreatorUserID     string `json:"creator_user_id,omitempty" v-create:"isdefault"`
	AWSAssumeRoleArn  string `json:"aws_assume_role_arn,omitempty"`
	AWSAccessKey      string `json:"aws_access_key,omitempty"`
	AWSSecretKey      string `json:"aws_secret_key,omitempty"`
	AWSSQSRegion      string `json:"aws_sqs_region,omitempty"`
	AWSSQSQueueName   string `json:"aws_sqs_queue_name,omitempty"`
	AWSS3Region       string `json:"aws_s3_region,omitempty"`
	ThrottlingAllowed bool   `json:"throttling_allowed,omitempty"`
	OverrideSource    string `json:"override_source,omitempty"`
}

InputAWSCloudTrailAttrs represents aws cloud trail Input's attributes.

func (InputAWSCloudTrailAttrs) InputType

func (attrs InputAWSCloudTrailAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputAWSCloudWatchLogsAttrs

type InputAWSCloudWatchLogsAttrs struct {
	AWSRegion         string `json:"aws_region,omitempty"`
	AWSAssumeRoleArn  string `json:"aws_assume_role_arn,omitempty"`
	AWSAccessKey      string `json:"aws_access_key,omitempty"`
	AWSSecretKey      string `json:"aws_secret_key,omitempty"`
	KinesisStreamName string `json:"kinesis_stream_name,omitempty"`
	ThrottlingAllowed bool   `json:"throttling_allowed,omitempty"`
	OverrideSource    string `json:"override_source,omitempty"`
}

InputAWSCloudWatchLogsAttrs represents AWS logs Input's attributes.

func (InputAWSCloudWatchLogsAttrs) InputType

func (attrs InputAWSCloudWatchLogsAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputAWSFlowLogsAttrs

type InputAWSFlowLogsAttrs struct {
	AWSRegion         string `json:"aws_region,omitempty"`
	AWSAssumeRoleArn  string `json:"aws_assume_role_arn,omitempty"`
	AWSAccessKey      string `json:"aws_access_key,omitempty"`
	AWSSecretKey      string `json:"aws_secret_key,omitempty"`
	KinesisStreamName string `json:"kinesis_stream_name,omitempty"`
	ThrottlingAllowed bool   `json:"throttling_allowed,omitempty"`
}

InputAWSFlowLogsAttrs represents AWS flow logs Input's attributes.

func (InputAWSFlowLogsAttrs) InputType

func (attrs InputAWSFlowLogsAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputAttrs

type InputAttrs interface {
	InputType() string
}

InputAttrs represents Input Attributes. A receiver must be a pointer.

func NewInputAWSCloudTrailAttrs

func NewInputAWSCloudTrailAttrs() InputAttrs

NewInputAWSCloudTrailAttrs is the constructor of InputAWSCloudTrailAttrs.

func NewInputAWSCloudWatchLogsAttrs

func NewInputAWSCloudWatchLogsAttrs() InputAttrs

NewInputAWSCloudWatchLogsAttrs is the constructor of InputAWSCloudWatchLogsAttrs.

func NewInputAWSFlowLogsAttrs

func NewInputAWSFlowLogsAttrs() InputAttrs

NewInputAWSFlowLogsAttrs is the constructor of InputAWSFlowLogsAttrs.

func NewInputAttrsByType

func NewInputAttrsByType(t string) InputAttrs

NewInputAttrsByType returns a new InputAttrs.

func NewInputBeatsAttrs

func NewInputBeatsAttrs() InputAttrs

NewInputBeatsAttrs is the constructor of InputBeatsAttrs.

func NewInputCEFAMQPAttrs

func NewInputCEFAMQPAttrs() InputAttrs

NewInputCEFAMQPAttrs is the constructor of InputCEFAMQPAttrs.

func NewInputCEFKafkaAttrs

func NewInputCEFKafkaAttrs() InputAttrs

NewInputCEFKafkaAttrs is the constructor of InputCEFKafkaAttrs.

func NewInputCEFTCPAttrs

func NewInputCEFTCPAttrs() InputAttrs

NewInputCEFTCPAttrs is the constructor of InputCEFTCPAttrs.

func NewInputCEFUDPAttrs

func NewInputCEFUDPAttrs() InputAttrs

NewInputCEFUDPAttrs is the constructor of InputCEFUDPAttrs.

func NewInputFakeHTTPMessageAttrs

func NewInputFakeHTTPMessageAttrs() InputAttrs

NewInputFakeHTTPMessageAttrs is the constructor of InputFakeHTTPMessageAttrs.

func NewInputGELFAMQPAttrs

func NewInputGELFAMQPAttrs() InputAttrs

NewInputGELFAMQPAttrs is the constructor of InputGELFAMQPAttrs.

func NewInputGELFHTTPAttrs

func NewInputGELFHTTPAttrs() InputAttrs

NewInputGELFHTTPAttrs is the constructor of InputGELFHTTPAttrs.

func NewInputGELFKafkaAttrs

func NewInputGELFKafkaAttrs() InputAttrs

NewInputGELFKafkaAttrs is the constructor of InputGELFKafkaAttrs.

func NewInputGELFTCPAttrs

func NewInputGELFTCPAttrs() InputAttrs

NewInputGELFTCPAttrs is the constructor of InputGELFTCPAttrs.

func NewInputGELFUDPAttrs

func NewInputGELFUDPAttrs() InputAttrs

NewInputGELFUDPAttrs is the constructor of InputGELFUDPAttrs.

func NewInputJSONPathAttrs

func NewInputJSONPathAttrs() InputAttrs

NewInputJSONPathAttrs is the constructor of InputJSONPathAttrs.

func NewInputNetFlowUDPAttrs

func NewInputNetFlowUDPAttrs() InputAttrs

NewInputNetFlowUDPAttrs is the constructor of InputNetFlowUDPAttrs.

func NewInputRawAMQPAttrs

func NewInputRawAMQPAttrs() InputAttrs

NewInputRawAMQPAttrs is the constructor of InputRawAMQPAttrs.

func NewInputRawKafkaAttrs

func NewInputRawKafkaAttrs() InputAttrs

NewInputRawKafkaAttrs is the constructor of InputRawKafkaAttrs.

func NewInputSyslogAMQPAttrs

func NewInputSyslogAMQPAttrs() InputAttrs

NewInputSyslogAMQPAttrs is the constructor of InputSyslogAMQPAttrs.

func NewInputSyslogKafkaAttrs

func NewInputSyslogKafkaAttrs() InputAttrs

NewInputSyslogKafkaAttrs is the constructor of InputSyslogKafkaAttrs.

func NewInputSyslogTCPAttrs

func NewInputSyslogTCPAttrs() InputAttrs

NewInputSyslogTCPAttrs is the constructor of InputSyslogTCPAttrs.

func NewInputSyslogUDPAttrs

func NewInputSyslogUDPAttrs() InputAttrs

NewInputSyslogUDPAttrs is the constructor of InputSyslogUDPAttrs.

type InputBeatsAttrs

type InputBeatsAttrs struct {
	BindAddress           string `json:"bind_address,omitempty" v-create:"required" v-update:"required"`
	OverrideSource        string `json:"override_source,omitempty"`
	TLSKeyFile            string `json:"tls_key_file,omitempty"`
	TLSKeyPassword        string `json:"tls_key_password,omitempty"`
	TLSClientAuthCertFile string `json:"tls_client_auth_cert_file,omitempty"`
	TLSClientAuth         string `json:"tls_client_auth,omitempty"`
	TLSCertFile           string `json:"tls_cert_file,omitempty"`
	TLSEnable             bool   `json:"tls_enable,omitempty"`
	TCPKeepAlive          bool   `json:"tcp_keepalive,omitempty"`
	Port                  int    `json:"port,omitempty" v-create:"required" v-update:"required"`
	RecvBufferSize        int    `json:"recv_buffer_size,omitempty" v-create:"required" v-update:"required"`
}

InputBeatsAttrs represents Beats Input's attributes.

func (InputBeatsAttrs) InputType

func (attrs InputBeatsAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputCEFAMQPAttrs

type InputCEFAMQPAttrs struct {
	Exchange               string `json:"exchange,omitempty"`
	Timezone               string `json:"timezone,omitempty"`
	BrokerPassword         string `json:"broker_password,omitempty"`
	Locale                 string `json:"locale,omitempty"`
	BrokerHostname         string `json:"broker_hostname,omitempty"`
	Queue                  string `json:"queue,omitempty"`
	BrokerVHost            string `json:"broker_vhost,omitempty"`
	BrokerUsername         string `json:"broker_username,omitempty"`
	RoutingKey             string `json:"routing_key,omitempty"`
	Heartbeat              int    `json:"heartbeat,omitempty"`
	ParallelQueues         int    `json:"parallel_queues,omitempty"`
	Prefetch               int    `json:"prefetch,omitempty"`
	BrokerPort             int    `json:"broker_port,omitempty"`
	ExchangeBind           bool   `json:"exchange_bind,omitempty"`
	RequeueInvalidMessages bool   `json:"requeue_invalid_messages,omitempty"`
	UseFullNames           bool   `json:"use_full_names,omitempty"`
	TLS                    bool   `json:"tls,omitempty"`
	ThrottlingAllowed      bool   `json:"throttling_allowed,omitempty"`
}

InputCEFAMQPAttrs represents CEF AMQP Input's attributes.

func (InputCEFAMQPAttrs) InputType

func (attrs InputCEFAMQPAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputCEFKafkaAttrs

type InputCEFKafkaAttrs struct {
	ThrottlingAllowed bool   `json:"throttling_allowed,omitempty"`
	UseFullNames      bool   `json:"use_full_names,omitempty"`
	Locale            string `json:"locale,omitempty"`
	Zookeeper         string `json:"zookeeper,omitempty"`
	Timezone          string `json:"timezone,omitempty"`
	TopicFilter       string `json:"topic_filter,omitempty"`
	OffsetReset       string `json:"offset_reset,omitempty"`
	Threads           int    `json:"threads,omitempty"`
	FetchWaitMax      int    `json:"fetch_wait_max,omitempty"`
	FetchMinBytes     int    `json:"fetch_min_bytes,omitempty"`
}

InputCEFKafkaAttrs represents CEF Kafka Input's attributes.

func (InputCEFKafkaAttrs) InputType

func (attrs InputCEFKafkaAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputCEFTCPAttrs

type InputCEFTCPAttrs struct {
	UseNullDelimiter      bool   `json:"use_null_delimiter,omitempty"`
	UseFullNames          bool   `json:"use_full_names,omitempty"`
	TLSEnable             bool   `json:"tls_enable,omitempty"`
	TCPKeepAlive          bool   `json:"tcp_keepalive,omitempty"`
	MaxMessageSize        int    `json:"max_message_size,omitempty"`
	Port                  int    `json:"port,omitempty" v-create:"required" v-update:"required"`
	RecvBufferSize        int    `json:"recv_buffer_size,omitempty" v-create:"required" v-update:"required"`
	Timezone              string `json:"timezone,omitempty"`
	Locale                string `json:"locale,omitempty"`
	BindAddress           string `json:"bind_address,omitempty" v-create:"required" v-update:"required"`
	TLSKeyFile            string `json:"tls_key_file,omitempty"`
	TLSClientAuth         string `json:"tls_client_auth,omitempty"`
	TLSKeyPassword        string `json:"tls_key_password,omitempty"`
	TLSClientAuthCertFile string `json:"tls_client_auth_cert_file,omitempty"`
	TLSCertFile           string `json:"tls_cert_file,omitempty"`
}

InputCEFTCPAttrs represents CEF TCP Input's attributes.

func (InputCEFTCPAttrs) InputType

func (attrs InputCEFTCPAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputCEFUDPAttrs

type InputCEFUDPAttrs struct {
	Locale         string `json:"locale,omitempty"`
	UseFullNames   bool   `json:"use_full_names,omitempty"`
	Timezone       string `json:"timezone,omitempty"`
	BindAddress    string `json:"bind_address,omitempty" v-create:"required" v-update:"required"`
	Port           int    `json:"port,omitempty" v-create:"required" v-update:"required"`
	RecvBufferSize int    `json:"recv_buffer_size,omitempty" v-create:"required" v-update:"required"`
}

InputCEFUDPAttrs represents CEF UDP Input's attributes.

func (InputCEFUDPAttrs) InputType

func (attrs InputCEFUDPAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputData

type InputData struct {
	Title         string                 `json:"title,omitempty"`
	Type          string                 `json:"type,omitempty"`
	ID            string                 `json:"id,omitempty"`
	Node          string                 `json:"node,omitempty"`
	CreatedAt     string                 `json:"created_at,omitempty"`
	CreatorUserID string                 `json:"creator_user_id,omitempty"`
	Global        bool                   `json:"global,omitempty"`
	Attrs         map[string]interface{} `json:"attributes,omitempty"`
}

InputData represents data of Input. This is used for data conversion of Input. ex. json.Unmarshal

func (*InputData) ToInput

func (d *InputData) ToInput(input *Input) error

ToInput copies InputData's data to Input.

type InputFakeHTTPMessageAttrs

type InputFakeHTTPMessageAttrs struct {
	Sleep             int    `json:"sleep,omitempty"`
	SleepDeviation    int    `json:"sleep_deviation,omitempty"`
	Source            string `json:"source,omitempty"`
	OverrideSource    string `json:"override_source,omitempty"`
	ThrottlingAllowed bool   `json:"throttling_allowed,omitempty"`
}

InputFakeHTTPMessageAttrs represents fake HTTP message Input's attributes.

func (InputFakeHTTPMessageAttrs) InputType

func (attrs InputFakeHTTPMessageAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputGELFAMQPAttrs

type InputGELFAMQPAttrs struct {
	ExchangeBind           bool   `json:"exchange_bind,omitempty"`
	ThrottlingAllowed      bool   `json:"throttling_allowed,omitempty"`
	TLS                    bool   `json:"tls,omitempty"`
	RequeueInvalidMessages bool   `json:"requeue_invalid_messages,omitempty"`
	BrokerVHost            string `json:"broker_vhost,omitempty"`
	BrokerUsername         string `json:"broker_username,omitempty"`
	Queue                  string `json:"queue,omitempty"`
	RoutingKey             string `json:"routing_key,omitempty"`
	OverrideSource         string `json:"override_source,omitempty"`
	BrokerHostname         string `json:"broker_hostname,omitempty"`
	Exchange               string `json:"exchange,omitempty"`
	BrokerPassword         string `json:"broker_password,omitempty"`
	Prefetch               int    `json:"prefetch,omitempty"`
	Heartbeat              int    `json:"heartbeat,omitempty"`
	DecompressSizeLimit    int    `json:"decompress_size_limit,omitempty"`
	BrokerPort             int    `json:"broker_port,omitempty"`
	ParallelQueues         int    `json:"parallel_queues,omitempty"`
}

InputGELFAMQPAttrs represents GELF AMQP Input's attributes.

func (InputGELFAMQPAttrs) InputType

func (attrs InputGELFAMQPAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputGELFHTTPAttrs

type InputGELFHTTPAttrs struct {
	IdleWriterTimeOut     int    `json:"idle_writer_timeout,omitempty"`
	RecvBufferSize        int    `json:"recv_buffer_size,omitempty" v-create:"required" v-update:"required"`
	MaxChunkSize          int    `json:"max_chunk_size,omitempty"`
	Port                  int    `json:"port,omitempty" v-create:"required" v-update:"required"`
	DecompressSizeLimit   int    `json:"decompress_size_limit,omitempty"`
	TLSClientAuthCertFile string `json:"tls_client_auth_cert_file,omitempty"`
	BindAddress           string `json:"bind_address,omitempty" v-create:"required" v-update:"required"`
	TLSCertFile           string `json:"tls_cert_file,omitempty"`
	TLSKeyFile            string `json:"tls_key_file,omitempty"`
	TLSKeyPassword        string `json:"tls_key_password,omitempty"`
	TLSClientAuth         string `json:"tls_client_auth,omitempty"`
	OverrideSource        string `json:"override_source,omitempty"`
	TCPKeepAlive          bool   `json:"tcp_keepalive,omitempty"`
	EnableCORS            bool   `json:"enable_cors,omitempty"`
	TLSEnable             bool   `json:"tls_enable,omitempty"`
}

InputGELFHTTPAttrs represents GELF HTTP Input's attributes.

func (InputGELFHTTPAttrs) InputType

func (attrs InputGELFHTTPAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputGELFKafkaAttrs

type InputGELFKafkaAttrs struct {
	OverrideSource      string `json:"override_source,omitempty"`
	DecompressSizeLimit int    `json:"decompress_size_limit,omitempty"`
	TopicFilter         string `json:"topic_filter,omitempty"`
	ThrottlingAllowed   bool   `json:"throttling_allowed,omitempty"`
	FetchWaitMax        int    `json:"fetch_wait_max,omitempty"`
	FetchMinBytes       int    `json:"fetch_min_bytes,omitempty"`
	OffsetReset         string `json:"offset_reset,omitempty"`
	Threads             int    `json:"threads,omitempty"`
	Zookeeper           string `json:"zookeeper,omitempty"`
}

InputGELFKafkaAttrs represents GELF Kafka Input's attributes.

func (InputGELFKafkaAttrs) InputType

func (attrs InputGELFKafkaAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputGELFTCPAttrs

type InputGELFTCPAttrs struct {
	MaxMessageSize        int    `json:"max_message_size,omitempty"`
	DecompressSizeLimit   int    `json:"decompress_size_limit,omitempty"`
	Port                  int    `json:"port,omitempty" v-create:"required" v-update:"required"`
	RecvBufferSize        int    `json:"recv_buffer_size,omitempty" v-create:"required" v-update:"required"`
	BindAddress           string `json:"bind_address,omitempty" v-create:"required" v-update:"required"`
	OverrideSource        string `json:"override_source,omitempty"`
	TLSKeyFile            string `json:"tls_key_file,omitempty"`
	TLSKeyPassword        string `json:"tls_key_password,omitempty"`
	TLSClientAuthCertFile string `json:"tls_client_auth_cert_file,omitempty"`
	TLSClientAuth         string `json:"tls_client_auth,omitempty"`
	TLSCertFile           string `json:"tls_cert_file,omitempty"`
	UseNullDelimiter      bool   `json:"use_null_delimiter,omitempty"`
	TLSEnable             bool   `json:"tls_enable,omitempty"`
	TCPKeepAlive          bool   `json:"tcp_keepalive,omitempty"`
}

InputGELFTCPAttrs represents GELF TCP Input's attributes.

func (InputGELFTCPAttrs) InputType

func (attrs InputGELFTCPAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputGELFUDPAttrs

type InputGELFUDPAttrs struct {
	DecompressSizeLimit int    `json:"decompress_size_limit,omitempty"`
	OverrideSource      string `json:"override_source,omitempty"`
	BindAddress         string `json:"bind_address,omitempty" v-create:"required" v-update:"required"`
	Port                int    `json:"port,omitempty" v-create:"required" v-update:"required"`
	RecvBufferSize      int    `json:"recv_buffer_size,omitempty" v-create:"required" v-update:"required"`
}

InputGELFUDPAttrs represents GELF UDP Input's attributes.

func (InputGELFUDPAttrs) InputType

func (attrs InputGELFUDPAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputJSONPathAttrs

type InputJSONPathAttrs struct {
	ThrottlingAllowed bool   `json:"throttling_allowed,omitempty"`
	OverrideSource    string `json:"override_source,omitempty"`
	Headers           string `json:"headers,omitempty"`
	Path              string `json:"path,omitempty"`
	TargetURL         string `json:"target_url,omitempty"`
	Interval          int    `json:"interval,omitempty"`
	Source            string `json:"source,omitempty"`
	Timeunit          string `json:"timeunit,omitempty"`
}

InputJSONPathAttrs represents JSON path Input's attributes.

func (InputJSONPathAttrs) InputType

func (attrs InputJSONPathAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputNetFlowUDPAttrs

type InputNetFlowUDPAttrs struct {
	NetFlow9DefinitionsPath string `json:"netflow9_definitions_path,omitempty"`
	OverrideSource          string `json:"override_source,omitempty"`
	BindAddress             string `json:"bind_address,omitempty" v-create:"required" v-update:"required"`
	Port                    int    `json:"port,omitempty" v-create:"required" v-update:"required"`
	RecvBufferSize          int    `json:"recv_buffer_size,omitempty" v-create:"required" v-update:"required"`
}

InputNetFlowUDPAttrs represents net flow UDP Input's attributes.

func (InputNetFlowUDPAttrs) InputType

func (attrs InputNetFlowUDPAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputRawAMQPAttrs

type InputRawAMQPAttrs struct {
	ParallelQueues         int    `json:"parallel_queues,omitempty"`
	HeartBeat              int    `json:"heartbeat,omitempty"`
	BrokerPort             int    `json:"broker_port,omitempty"`
	Prefetch               int    `json:"prefetch,omitempty"`
	RequeueInvalidMessages bool   `json:"requeue_invalid_messages,omitempty"`
	TLS                    bool   `json:"tls,omitempty"`
	ExchangeBind           bool   `json:"exchange_bind,omitempty"`
	ThrottlingAllowed      bool   `json:"throttling_allowed,omitempty"`
	Exchange               string `json:"exchange,omitempty"`
	RoutingKey             string `json:"routing_key,omitempty"`
	BrokerHostname         string `json:"broker_hostname,omitempty"`
	Queue                  string `json:"queue,omitempty"`
	BrokerPassword         string `json:"broker_password,omitempty"`
	BrokerVHost            string `json:"broker_vhost,omitempty"`
	BrokerUsername         string `json:"broker_username,omitempty"`
	OverrideSource         string `json:"override_source,omitempty"`
}

InputRawAMQPAttrs represents raw AMQP Input's attributes.

func (InputRawAMQPAttrs) InputType

func (attrs InputRawAMQPAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputRawKafkaAttrs

type InputRawKafkaAttrs struct {
	TopicFilter       string `json:"topic_filter,omitempty"`
	FetchWaitMax      int    `json:"fetch_wait_max,omitempty"`
	OffsetReset       string `json:"offset_reset,omitempty"`
	Zookeeper         string `json:"zookeeper,omitempty"`
	ThrottlingAllowed bool   `json:"throttling_allowed,omitempty"`
	FetchMinBytes     int    `json:"fetch_min_bytes,omitempty"`
	Threads           int    `json:"threads,omitempty"`
	OverrideSource    string `json:"override_source,omitempty"`
}

InputRawKafkaAttrs represents RawKafka Input's attributes.

func (InputRawKafkaAttrs) InputType

func (attrs InputRawKafkaAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputSyslogAMQPAttrs

type InputSyslogAMQPAttrs struct {
	Heartbeat              int    `json:"heartbeat,omitempty"`
	Prefetch               int    `json:"prefetch,omitempty"`
	BrokerPort             int    `json:"broker_port,omitempty"`
	ParallelQueues         int    `json:"parallel_queues,omitempty"`
	BrokerVHost            string `json:"broker_vhost,omitempty"`
	BrokerUsername         string `json:"broker_username,omitempty"`
	BrokerPassword         string `json:"broker_password,omitempty"`
	Exchange               string `json:"exchange,omitempty"`
	OverrideSource         string `json:"override_source,omitempty"`
	RoutingKey             string `json:"routing_key,omitempty"`
	BrokerHostname         string `json:"broker_hostname,omitempty"`
	Queue                  string `json:"queue,omitempty"`
	ExchangeBind           bool   `json:"exchange_bind,omitempty"`
	ForceRDNS              bool   `json:"force_rdns,omitempty"`
	StoreFullMessage       bool   `json:"store_full_message,omitempty"`
	ExpandStructuredData   bool   `json:"expand_structured_data,omitempty"`
	ThrottlingAllowed      bool   `json:"throttling_allowed,omitempty"`
	TLS                    bool   `json:"tls,omitempty"`
	AllowOverrideDate      bool   `json:"allow_override_date,omitempty"`
	RequeueInvalidMessages bool   `json:"requeue_invalid_messages,omitempty"`
}

InputSyslogAMQPAttrs represents SyslogAMQP Input's attributes.

func (InputSyslogAMQPAttrs) InputType

func (attrs InputSyslogAMQPAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputSyslogKafkaAttrs

type InputSyslogKafkaAttrs struct {
	ForceRDNS            bool   `json:"force_rdns,omitempty"`
	StoreFullMessage     bool   `json:"store_full_message,omitempty"`
	ExpandStructuredData bool   `json:"expand_structured_data,omitempty"`
	AllowOverrideDate    bool   `json:"allow_override_date,omitempty"`
	ThrottlingAllowed    bool   `json:"throttling_allowed,omitempty"`
	OverrideSource       string `json:"override_source,omitempty"`
	TopicFilter          string `json:"topic_filter,omitempty"`
	FetchWaitMax         int    `json:"fetch_wait_max,omitempty"`
	OffsetReset          string `json:"offset_reset,omitempty"`
	Zookeeper            string `json:"zookeeper,omitempty"`
	FetchMinBytes        int    `json:"fetch_min_bytes,omitempty"`
	Threads              int    `json:"threads,omitempty"`
}

InputSyslogKafkaAttrs represents SyslogKafka Input's attributes.

func (InputSyslogKafkaAttrs) InputType

func (attrs InputSyslogKafkaAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputSyslogTCPAttrs

type InputSyslogTCPAttrs struct {
	Port           int    `json:"port,omitempty" v-create:"required" v-update:"required"`
	BindAddress    string `json:"bind_address,omitempty" v-create:"required" v-update:"required"`
	RecvBufferSize int    `json:"recv_buffer_size,omitempty" v-create:"required" v-update:"required"`
}

InputSyslogTCPAttrs represents SyslogTCP Input's attributes.

func (InputSyslogTCPAttrs) InputType

func (attrs InputSyslogTCPAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputSyslogUDPAttrs

type InputSyslogUDPAttrs struct {
	BindAddress            string `json:"bind_address,omitempty" v-create:"required" v-update:"required"`
	Port                   int    `json:"port,omitempty" v-create:"required" v-update:"required"`
	RecvBufferSize         int    `json:"recv_buffer_size,omitempty" v-create:"required" v-update:"required"`
	TCPKeepAlive           bool   `json:"tcp_keepalive,omitempty"`
	TLSEnable              bool   `json:"tls_enable,omitempty"`
	ThrottlingAllowed      bool   `json:"throttling_allowed,omitempty"`
	EnableCORS             bool   `json:"enable_cors,omitempty"`
	UseNullDelimiter       bool   `json:"use_null_delimiter,omitempty"`
	ExchangeBind           bool   `json:"exchange_bind,omitempty"`
	ForceRDNS              bool   `json:"force_rdns,omitempty"`
	StoreFullMessage       bool   `json:"store_full_message,omitempty"`
	ExpandStructuredData   bool   `json:"expand_structured_data,omitempty"`
	AllowOverrideDate      bool   `json:"allow_override_date,omitempty"`
	RequeueInvalidMessages bool   `json:"requeue_invalid_messages,omitempty"`
	UseFullNames           bool   `json:"use_full_names,omitempty"`
	TLS                    bool   `json:"tls,omitempty"`
}

InputSyslogUDPAttrs represents SyslogUDP Input's attributes.

func (InputSyslogUDPAttrs) InputType

func (attrs InputSyslogUDPAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputUnknownAttrs

type InputUnknownAttrs struct {
	Data map[string]interface{}
	// contains filtered or unexported fields
}

InputUnknownAttrs represents unknown type's Input Attrs.

func (InputUnknownAttrs) InputType

func (attrs InputUnknownAttrs) InputType() string

InputType is the implementation of the InputAttrs interface.

type InputUpdateParams

type InputUpdateParams struct {
	ID     string     `json:"id,omitempty" v-update:"required,objectid"`
	Title  string     `json:"title,omitempty" v-update:"required"`
	Type   string     `json:"type,omitempty" v-update:"required"`
	Attrs  InputAttrs `json:"attributes,omitempty" v-update:"required"`
	Global *bool      `json:"global,omitempty"`
	Node   string     `json:"node,omitempty"`
}

InputUpdateParams represents Graylog Input update API's parameter.

type InputUpdateParamsData

type InputUpdateParamsData struct {
	ID     string                 `json:"id,omitempty"`
	Title  string                 `json:"title,omitempty"`
	Type   string                 `json:"type,omitempty"`
	Node   string                 `json:"node,omitempty"`
	Global *bool                  `json:"global,omitempty"`
	Attrs  map[string]interface{} `json:"attributes,omitempty"`
}

InputUpdateParamsData represents InputUpdateParams's data. This is used for data conversion of InputUpdateParams. ex. json.Unmarshal

func (*InputUpdateParamsData) ToInputUpdateParams

func (d *InputUpdateParamsData) ToInputUpdateParams(input *InputUpdateParams) error

ToInputUpdateParams copies InputUpdateParamsData's data to InputUpdateParams.

type InputsBody

type InputsBody struct {
	Inputs []Input `json:"inputs"`
	Total  int     `json:"total"`
}

InputsBody represents Get Inputs API's response body. Basically users don't use this struct, but this struct is public because some sub packages use this struct.

type LDAPSetting added in v0.6.0

type LDAPSetting struct {
	Enabled                 bool              `json:"enabled,omitempty"`
	UseStartTLS             bool              `json:"use_start_tls,omitempty"`
	TrustAllCertificates    bool              `json:"trust_all_certificates,omitempty"`
	ActiveDirectory         bool              `json:"active_directory,omitempty"`
	SystemUsername          string            `json:"system_username" v-create:"required" v-update:"required"`
	SystemPassword          string            `json:"system_password" v-create:"required" v-update:"required"`
	LDAPURI                 string            `json:"ldap_uri" v-create:"required" v-update:"required"`
	SearchBase              string            `json:"search_base" v-create:"required" v-update:"required"`
	SearchPattern           string            `json:"search_pattern" v-create:"required" v-update:"required"`
	DisplayNameAttribute    string            `json:"display_name_attribute" v-create:"required" v-update:"required"`
	DefaultGroup            string            `json:"default_group" v-create:"required" v-update:"required"`
	GroupSearchBase         string            `json:"group_search_base,omitempty"`
	GroupIDAttribute        string            `json:"group_id_attribute,omitempty"`
	GroupSearchPattern      string            `json:"group_search_pattern,omitempty"`
	GroupMapping            map[string]string `json:"group_mapping,omitempty"`
	AdditionalDefaultGroups set.StrSet        `json:"additional_default_groups,omitempty"`
}

LDAPSetting represents a ldap settings.

type MessageCountAlertConditionParameters added in v1.0.0

type MessageCountAlertConditionParameters struct {
	Grace               int    `json:"grace"`
	Backlog             int    `json:"backlog"`
	Threshold           int    `json:"threshold"`
	Time                int    `json:"time"`
	RepeatNotifications bool   `json:"repeat_notifications,omitempty"`
	Query               string `json:"query,omitempty"`
	ThresholdType       string `json:"threshold_type,omitempty" v-create:"required"`
}

MessageCountAlertConditionParameters represents Field Aggregation Alert Condition's parameters.

func (MessageCountAlertConditionParameters) AlertConditionType added in v1.0.0

func (p MessageCountAlertConditionParameters) AlertConditionType() string

AlertConditionType returns an alert condition type.

type NewInputAttrs

type NewInputAttrs func() InputAttrs

NewInputAttrs is the constructor of InputAttrs.

type Output

type Output struct{}

Output represents an output.

type Pipeline

type Pipeline struct {
	// required
	Source string          `json:"source,omitempty" v-create:"required" v-update:"required"`
	ID     string          `json:"id,omitempty" v-create:"isdefault" v-update:"required"`
	Title  string          `json:"title,omitempty"`
	Stages []PipelineStage `json:"stages"`

	Description string `json:"description,omitempty"`
}

Pipeline represents a Graylog's Pipeline. http://docs.graylog.org/en/3.0/pages/pipelines/pipelines.html

type PipelineConnection

type PipelineConnection struct {
	ID          string   `json:"id"`
	StreamID    string   `json:"stream_id"`
	PipelineIDs []string `json:"pipeline_ids"`
}

PipelineConnection is a pipeline connection.

type PipelineRule added in v1.4.0

type PipelineRule struct {
	// required
	Source string `json:"source,omitempty" v-create:"required" v-update:"required"`
	ID     string `json:"id,omitempty" v-create:"isdefault" v-update:"required"`
	// Note that title is ignored in create and update API.
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
}

PipelineRule represents a Graylog's Pipeline Rule. http://docs.graylog.org/en/3.0/pages/pipelines/rules.html

type PipelineStage

type PipelineStage struct {
	Stage    int      `json:"stage"`
	MatchAll bool     `json:"match_all"`
	Rules    []string `json:"rules"`
}

PipelineStage is a stage of pipelines.

type Preferences

type Preferences struct {
	UpdateUnfocussed  bool `json:"updateUnfocussed,omitempty"`
	EnableSmartSearch bool `json:"enableSmartSearch,omitempty"`
}

Preferences represents user's preferences.

type RetentionStrategy

type RetentionStrategy struct {
	// ex. "org.graylog2.indexer.retention.strategies.DeletionRetentionStrategyConfig"
	Type string `json:"type,omitempty"`
	// ex. 20
	MaxNumberOfIndices int `json:"max_number_of_indices,omitempty"`
}

RetentionStrategy represents a Graylog's Index Set Retention Strategy.

func NewClosingRetentionStrategy

func NewClosingRetentionStrategy(num int) *RetentionStrategy

NewClosingRetentionStrategy returns a new closing RetentionStrategy.

func NewDeletionRetentionStrategy

func NewDeletionRetentionStrategy(num int) *RetentionStrategy

NewDeletionRetentionStrategy returns a new deletion RetentionStrategy.

func NewNoopRetentionStrategy

func NewNoopRetentionStrategy(num int) *RetentionStrategy

NewNoopRetentionStrategy returns a new noop RetentionStrategy.

type Role

type Role struct {
	Name        string `json:"name,omitempty" v-create:"required" v-update:"required"`
	Description string `json:"description,omitempty"`
	// ex. ["clusterconfigentry:read", "users:edit"]
	Permissions set.StrSet `json:"permissions,omitempty" v-create:"required" v-update:"required"`
	ReadOnly    bool       `json:"read_only,omitempty"`
}

Role represents a role.

func (*Role) NewUpdateParams

func (role *Role) NewUpdateParams() *RoleUpdateParams

NewUpdateParams returns Update Role API's parameters.

type RoleUpdateParams

type RoleUpdateParams struct {
	Name        string  `json:"name,omitempty" v-create:"required" v-update:"required"`
	Description *string `json:"description,omitempty"`
	// ex. ["clusterconfigentry:read", "users:edit"]
	Permissions set.StrSet `json:"permissions,omitempty" v-create:"required" v-update:"required"`
}

RoleUpdateParams represents Update Role API's parameters.

type RolesBody

type RolesBody struct {
	Roles []Role `json:"roles"`
	Total int    `json:"total"`
}

RolesBody represents Get Roles API's response body. Basically users don't use this struct, but this struct is public because some sub packages use this struct.

type RotationStrategy

type RotationStrategy struct {
	// ex. "org.graylog2.indexer.rotation.strategies.MessageCountRotationStrategyConfig"
	Type string `json:"type,omitempty"`
	// ex. 20000000
	// Maximum number of documents in an index before it gets rotated
	MaxDocsPerIndex int `json:"max_docs_per_index,omitempty"`
	// time based
	// How long an index gets written to before it is rotated. (i.e. "P1D" for 1 day, "PT6H" for 6 hours)
	RotationPeriod string `json:"rotation_period,omitempty"`
	// size based
	// Maximum size of an index before it gets rotated
	MaxSize int `json:"max_size,omitempty"`
}

RotationStrategy represents a Graylog's Index Set Rotation Strategy.

func NewMessageCountRotationStrategy

func NewMessageCountRotationStrategy(count int) *RotationStrategy

NewMessageCountRotationStrategy returns a new message count based RotationStrategy.

func NewSizeBasedRotationStrategy

func NewSizeBasedRotationStrategy(size int) *RotationStrategy

NewSizeBasedRotationStrategy returns a new size based RotationStrategy.

func NewTimeBasedRotationStrategy

func NewTimeBasedRotationStrategy(period string) *RotationStrategy

NewTimeBasedRotationStrategy returns a new time based RotationStrategy.

type SlackAlarmCallbackConfiguration added in v1.1.0

type SlackAlarmCallbackConfiguration struct {
	Color         string `json:"color" v-create:"required"`
	WebhookURL    string `json:"webhook_url" v-create:"required"`
	Channel       string `json:"channel" v-create:"required"`
	IconURL       string `json:"icon_url,omitempty"`
	Graylog2URL   string `json:"graylog2_url,omitempty"`
	IconEmoji     string `json:"icon_emoji,omitempty"`
	UserName      string `json:"user_name,omitempty"`
	ProxyAddress  string `json:"proxy_address,omitempty"`
	CustomMessage string `json:"custom_message,omitempty"`
	BacklogItems  int    `json:"backlog_items,omitempty"`
	LinkNames     bool   `json:"link_names"`
	NotifyChannel bool   `json:"notify_channel"`
}

SlackAlarmCallbackConfiguration represents a configuration of SlackAlarmCallback. Note that SlackAlarmCallback is a third party plugin and not an official alarm callback. https://github.com/graylog-labs/graylog-plugin-slack

func (*SlackAlarmCallbackConfiguration) AlarmCallbackType added in v1.1.0

func (ac *SlackAlarmCallbackConfiguration) AlarmCallbackType() string

AlarmCallbackType returns an alarm callback type.

type Startpage

type Startpage struct {
	Type string `json:"type,omitempty"`
	ID   string `json:"id,omitempty"`
}

Startpage represents a user's startpage.

type Stream

type Stream struct {
	ID         string `json:"id,omitempty" v-create:"isdefault" v-update:"required,objectid"`
	Title      string `json:"title,omitempty" v-create:"required"`
	IndexSetID string `json:"index_set_id,omitempty" v-create:"required"`
	// ex. "2018-02-20T11:37:19.371Z"
	CreatedAt string `json:"created_at,omitempty" v-create:"isdefault"`
	// ex. local:admin
	CreatorUserID string `json:"creator_user_id,omitempty" v-create:"isdefault"`
	Description   string `json:"description,omitempty"`
	// ex. "AND"
	MatchingType                   string           `json:"matching_type,omitempty"`
	Outputs                        []Output         `json:"outputs,omitempty" v-create:"isdefault"`
	Rules                          []StreamRule     `json:"rules,omitempty"`
	AlertConditions                []AlertCondition `json:"alert_conditions,omitempty" v-create:"isdefault"`
	AlertReceivers                 *AlertReceivers  `json:"alert_receivers,omitempty" v-create:"isdefault"`
	Disabled                       bool             `json:"disabled,omitempty" v-create:"isdefault"`
	RemoveMatchesFromDefaultStream bool             `json:"remove_matches_from_default_stream,omitempty"`
	IsDefault                      bool             `json:"is_default,omitempty" v-create:"isdefault"`
}

Stream represents a steram.

func (*Stream) NewUpdateParams

func (stream *Stream) NewUpdateParams() *StreamUpdateParams

NewUpdateParams converts Stream to StreamUpdateParams.

type StreamRule

type StreamRule struct {
	ID          string `json:"id,omitempty" v-create:"isdefault"`
	StreamID    string `json:"stream_id,omitempty" v-create:"required"`
	Field       string `json:"field,omitempty" v-create:"required"`
	Value       string `json:"value,omitempty" v-create:"required"`
	Description string `json:"description,omitempty"`
	Type        int    `json:"type,omitempty"`
	Inverted    bool   `json:"inverted,omitempty"`
}

StreamRule represents a stream rule.

func (*StreamRule) NewUpdateParams

func (rule *StreamRule) NewUpdateParams() *StreamRuleUpdateParams

NewUpdateParams converts StreamRule to StreamRuleUpdateParams.

type StreamRuleUpdateParams

type StreamRuleUpdateParams struct {
	ID          string `json:"id,omitempty" v-update:"required,objectid"`
	StreamID    string `json:"stream_id,omitempty" v-update:"required,objectid"`
	Field       string `json:"field,omitempty" v-update:"required"`
	Value       string `json:"value,omitempty" v-update:"required"`
	Description string `json:"description,omitempty"`
	Type        *int   `json:"type,omitempty"`
	Inverted    *bool  `json:"inverted,omitempty"`
}

StreamRuleUpdateParams represents Update Stream API's paramteres.

type StreamRulesBody

type StreamRulesBody struct {
	Total       int          `json:"total"`
	StreamRules []StreamRule `json:"stream_rules"`
}

StreamRulesBody represents Get stream rules API's response body. Basically users don't use this struct, but this struct is public because some sub packages use this struct.

type StreamUpdateParams

type StreamUpdateParams struct {
	ID                             string           `json:"id,omitempty" v-update:"required,objectid"`
	Title                          string           `json:"title,omitempty"`
	IndexSetID                     string           `json:"index_set_id,omitempty"`
	Description                    string           `json:"description,omitempty"`
	Outputs                        []Output         `json:"outputs,omitempty"`
	MatchingType                   string           `json:"matching_type,omitempty"`
	Rules                          []StreamRule     `json:"rules,omitempty"`
	AlertConditions                []AlertCondition `json:"alert_conditions,omitempty"`
	AlertReceivers                 *AlertReceivers  `json:"alert_receivers,omitempty"`
	RemoveMatchesFromDefaultStream *bool            `json:"remove_matches_from_default_stream,omitempty"`
}

StreamUpdateParams represents a steram update params.

type StreamsBody

type StreamsBody struct {
	Total   int      `json:"total,omitempty"`
	Streams []Stream `json:"streams,omitempty"`
}

StreamsBody represents Get Streams API's response body. Basically users don't use this struct, but this struct is public because some sub packages use this struct.

type Timerange added in v0.4.0

type Timerange struct {
	Type  string `json:"type" v-create:"required"`
	Range int    `json:"range" v-create:"required"`
}

Timerange represents a timerange.

type User

type User struct {
	// a unique user name used to log in with.
	// ex. "local:admin"
	Username string `json:"username,omitempty" v-create:"required" v-update:"required"`
	// the contact email address
	Email string `json:"email,omitempty" v-create:"required"`
	// a descriptive name for this account, e.g. the full name.
	FullName string `json:"full_name,omitempty" v-create:"required"`
	Password string `json:"password,omitempty" v-create:"required"`

	ID string `json:"id,omitempty"`
	// the timezone to use to display times, or leave it as it is to use the system's default.
	// ex. "UTC"
	Timezone string `json:"timezone,omitempty"`
	// ex. "2018-03-02T06:32:01.841+0000"
	LastActivity string `json:"last_activity,omitempty"`
	// ex. "192.168.192.1"
	ClientAddress string `json:"client_address,omitempty"`
	// Session automatically end after this amount of time, unless they are actively used.
	// ex. 28800000
	SessionTimeoutMs int          `json:"session_timeout_ms,omitempty"`
	External         bool         `json:"external,omitempty"`
	ReadOnly         bool         `json:"read_only,omitempty"`
	SessionActive    bool         `json:"session_active,omitempty"`
	Preferences      *Preferences `json:"preferences,omitempty"`
	Startpage        *Startpage   `json:"startpage,omitempty"`
	// Assign the relevant roles to this user to grant them access to the relevant streams and dashboards.
	// The Reader role grants basic access to the system and will be enabled.
	// The Admin role grants access to everything in Graylog.
	// ex. ["Admin"]
	Roles       set.StrSet `json:"roles,omitempty"`
	Permissions set.StrSet `json:"permissions" v-create:"required"`
}

User represents a user.

func (*User) NewUpdateParams

func (user *User) NewUpdateParams() *UserUpdateParams

NewUpdateParams returns Update User API's parameters.

func (*User) SetDefaultValues

func (user *User) SetDefaultValues()

SetDefaultValues sets default values.

type UserUpdateParams

type UserUpdateParams struct {
	Username         string     `json:"username,omitempty" v-update:"required"`
	Email            *string    `json:"email,omitempty"`
	FullName         *string    `json:"full_name,omitempty"`
	Password         *string    `json:"password,omitempty"`
	Timezone         *string    `json:"timezone,omitempty"`
	SessionTimeoutMs *int       `json:"session_timeout_ms,omitempty"`
	Permissions      set.StrSet `json:"permissions,omitempty"`
	Startpage        *Startpage `json:"startpage,omitempty"`
	Roles            set.StrSet `json:"roles,omitempty"`
}

UserUpdateParams represents a user update API's parameter.

type UsersBody

type UsersBody struct {
	Users []User `json:"users"`
}

UsersBody represents Get Users API's response body. Basically users don't use this struct, but this struct is public because some sub packages use this struct.

type Widget added in v0.4.0

type Widget struct {
	// ex. "STREAM_SEARCH_RESULT_COUNT"
	Type          string        `json:"type,omitempty" v-create:"required"`
	Description   string        `json:"description,omitempty" v-create:"required"`
	CreatorUserID string        `json:"creator_user_id,omitempty" v-create:"isdefault"`
	ID            string        `json:"id,omitempty" v-create:"isdefault"`
	CacheTime     *int          `json:"cache_time,omitempty" v-create:"isdefault"`
	Config        *WidgetConfig `json:"config,omitempty" v-create:"required"`
}

Widget represents a Graylog's Dashboard Widget.

type WidgetConfig added in v0.4.0

type WidgetConfig struct {
	Timerange     *Timerange `json:"timerange" v-create:"required"`
	LowerIsBetter bool       `json:"lower_is_better,omitempty"`
	Trend         bool       `json:"trend,omitempty"`
	StreamID      string     `json:"stream_id,omitempty" v-create:"isdefault"`
	Query         string     `json:"query,omitempty" v-create:"isdefault"`
}

WidgetConfig represents a Graylog's Dashboard Widget configuration.

Directories

Path Synopsis
Package client provides Graylog API client.
Package client provides Graylog API client.
endpoint
Package endpoint provides Graylog API endpoints.
Package endpoint provides Graylog API endpoints.
Package mockserver provides Graylog API mock server.
Package mockserver provides Graylog API mock server.
exec
Run Graylog mock server.
Run Graylog mock server.
handler
Package handler provides handlers of Graylog API mock server.
Package handler provides handlers of Graylog API mock server.
logic
Package logic provides logic layers of Graylog API mock server.
Package logic provides logic layers of Graylog API mock server.
store
Package store provides store interface for Graylog API mock server.
Package store provides store interface for Graylog API mock server.
store/plain
Package plain provides the implementation of store.Store interface.
Package plain provides the implementation of store.Store interface.
graylog
Package graylog provides the terraform provider for Graylog.
Package graylog provides the terraform provider for Graylog.
Package testutil provides utilities for test.
Package testutil provides utilities for test.
Package validator provides validators for graylog's create and update APIs.
Package validator provides validators for graylog's create and update APIs.

Jump to

Keyboard shortcuts

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