components

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAwsRegion = "us-east-1"

DefaultAwsRegion defines the default region to use

Variables

This section is empty.

Functions

This section is empty.

Types

type AwsCredentials

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

AwsCredentials is a config struct for aws credential handling

Parameters

- Credential/Type: This value defines the credentials that are to be used when connecting to aws. Available values are listed below. See https://docs.aws.amazon.com/sdk-for-go/api/aws/credentials/#Credentials for more information.

  • environment: Retrieves credentials from the environment variables of the running process
  • static: Retrieves credentials value for individual credential fields
  • shared: Retrieves credentials from the current user's home directory
  • none: Use a anonymous login to aws

- Credential/Id: is used for "static" type and is used as the AccessKeyID

- Credential/Token: is used for "static" type and is used as the SessionToken

- Credential/Secret: is used for "static" type and is used as the SecretAccessKey

- Credential/File: is used for "shared" type and is used as the path to your shared Credentials file (~/.aws/credentials)

- Credential/Profile: is used for "shared" type and is used for the profile

- Credential/AssumeRole: This value is used to assume an IAM role using. By default this is set to "".

func (*AwsCredentials) CreateAwsCredentials

func (cred *AwsCredentials) CreateAwsCredentials() (*credentials.Credentials, error)

CreateAwsCredentials returns aws credentials.Credentials for active settings

type AwsMultiClient

type AwsMultiClient struct {
	Credentials AwsCredentials `gollumdoc:"embed_type"`
	// contains filtered or unexported fields
}

AwsMultiClient component

The AwsMultiClient is a helper component to handle aws access and client instantiation

Parameters

- Region: This value defines the used aws region. By default this is set to "us-east-1"

- Endpoint: This value defines the used aws api endpoint. If no endpoint is set the client needs to set the right endpoint for the used region. By default this is set to "".

func (*AwsMultiClient) Configure

func (client *AwsMultiClient) Configure(conf core.PluginConfigReader)

Configure method

func (*AwsMultiClient) GetConfig

func (client *AwsMultiClient) GetConfig() *aws.Config

GetConfig returns set *aws.Config

func (*AwsMultiClient) NewSessionWithOptions

func (client *AwsMultiClient) NewSessionWithOptions() (*session.Session, error)

NewSessionWithOptions returns a instantiated asw session

type BatchedWriter

type BatchedWriter interface {
	io.WriteCloser
	Name() string // base name of the file/resource
	Size() int64  // length in bytes for regular files; system-dependent for others
	IsAccessible() bool
}

BatchedWriter is an interface for different file writer like disk, s3, etc.

type BatchedWriterAssembly

type BatchedWriterAssembly struct {
	Batch   core.MessageBatch // Batch contains the MessageBatch
	Created time.Time         // Created contains the creation time from the writer was set
	// contains filtered or unexported fields
}

BatchedWriterAssembly is a helper struct for io.Writer compatible classes that use batch directly for resources

func NewBatchedWriterAssembly

func NewBatchedWriterAssembly(config BatchedWriterConfig, modulator core.Modulator, tryFallback func(*core.Message), logger logrus.FieldLogger) *BatchedWriterAssembly

NewBatchedWriterAssembly returns a new BatchedWriterAssembly instance

func (*BatchedWriterAssembly) Close

func (bwa *BatchedWriterAssembly) Close()

Close closes batch and writer

func (*BatchedWriterAssembly) Flush

func (bwa *BatchedWriterAssembly) Flush()

Flush flush the batch

func (*BatchedWriterAssembly) FlushOnTimeOut

func (bwa *BatchedWriterAssembly) FlushOnTimeOut()

FlushOnTimeOut checks if timeout or slush count reached and flush in this case

func (*BatchedWriterAssembly) GetWriter

func (bwa *BatchedWriterAssembly) GetWriter() BatchedWriter

GetWriter returns the current writer

func (*BatchedWriterAssembly) GetWriterAndUnset

func (bwa *BatchedWriterAssembly) GetWriterAndUnset() BatchedWriter

GetWriterAndUnset returns the current writer and unset it

func (*BatchedWriterAssembly) HasWriter

func (bwa *BatchedWriterAssembly) HasWriter() bool

HasWriter returns boolean value if a writer i currently set

func (*BatchedWriterAssembly) NeedsRotate

func (bwa *BatchedWriterAssembly) NeedsRotate(rotate RotateConfig, forceRotate bool) (bool, error)

NeedsRotate evaluate if the BatchedWriterAssembly need to rotate by the FileRotateConfig

func (*BatchedWriterAssembly) SetWriter

func (bwa *BatchedWriterAssembly) SetWriter(writer BatchedWriter)

SetWriter set a BatchedWriter interface implementation

func (*BatchedWriterAssembly) UnsetWriter

func (bwa *BatchedWriterAssembly) UnsetWriter()

UnsetWriter unset the current writer

type BatchedWriterConfig

type BatchedWriterConfig struct {
	BatchTimeout      time.Duration `config:"Batch/TimeoutSec" default:"5" metric:"sec"`
	BatchMaxCount     int           `config:"Batch/MaxCount" default:"8192"`
	BatchFlushCount   int           `config:"Batch/FlushCount" default:"4096"`
	BatchFlushTimeout time.Duration `config:"Batch/FlushTimeoutSec" default:"0" metric:"sec"`
}

BatchedWriterConfig defines batch configurations

Parameters

- Batch/TimeoutSec: This value defines the maximum number of seconds to wait after the last message arrived before a batch is flushed automatically. By default this parameter is set to "5".

- Batch/MaxCount: This value defines the maximum number of messages that can be buffered before a flush is mandatory. If the buffer is full and a flush is still underway or cannot be triggered out of other reasons, the producer will block. By default this parameter is set to "8192".

- Batch/FlushCount: This value defines the number of messages to be buffered before they are written to disk. This setting is clamped to "BatchMaxCount". By default this parameter is set to "`BatchMaxCount` / 2".

- Batch/FlushTimeoutSec: This value defines the maximum number of seconds to wait before a flush is aborted during shutdown. Set this parameter to "0" which does not abort the flushing procedure. By default this parameter is set to "0".

func (*BatchedWriterConfig) Configure

func (c *BatchedWriterConfig) Configure(conf core.PluginConfigReader)

Configure interface implementation

type RotateConfig

type RotateConfig struct {
	Timeout   time.Duration `config:"Rotation/TimeoutMin" default:"1440" metric:"min"`
	SizeByte  int64         `config:"Rotation/SizeMB" default:"1024" metric:"mb"`
	Timestamp string        `config:"Rotation/Timestamp" default:"2006-01-02_15"`
	ZeroPad   int           `config:"Rotation/ZeroPadding" default:"0"`
	AtHour    int           `config:"Rotation/AtHour" default:"-1"`
	AtMinute  int           `config:"Rotation/AtMin" default:"-1"`
	Compress  bool          `config:"Rotation/Compress" default:"false"`
	Enabled   bool          `config:"Rotation/Enable" default:"false"`
}

RotateConfig defines rotation settings

Parameters

- Rotation/Enable: If this value is set to "true" the logs will rotate after reaching certain thresholds. By default this parameter is set to "false".

- Rotation/TimeoutMin: This value defines a timeout in minutes that will cause the logs to rotate. Can be set in parallel with RotateSizeMB. By default this parameter is set to "1440".

- Rotation/SizeMB: This value defines the maximum file size in MB that triggers a file rotate. Files can get bigger than this size. By default this parameter is set to "1024".

- Rotation/Timestamp: This value sets the timestamp added to the filename when file rotation is enabled. The format is based on Go's time.Format function. By default this parameter is to to "2006-01-02_15".

- Rotation/ZeroPadding: This value sets the number of leading zeros when rotating files with an existing name. Setting this setting to 0 won't add zeros, every other number defines the number of leading zeros to be used. By default this parameter is set to "0".

- Rotation/Compress: This value defines if a rotated logfile is to be gzip compressed or not. By default this parameter is set to "false".

- Rotation/At: This value defines a specific time for rotation in hh:mm format. By default this parameter is set to "".

func NewRotateConfig

func NewRotateConfig() RotateConfig

NewRotateConfig create and returns a RotateConfig with default settings

func (*RotateConfig) Configure

func (rotate *RotateConfig) Configure(conf core.PluginConfigReader)

Configure method for interface implementation

Jump to

Keyboard shortcuts

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