cloudwatchlogs

package
v1.300055.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 23 Imported by: 0

README

Amazon CloudWatch Logs Output Plugin

For each configured target (log group/stream), the output plugin maintains a queue for log events that it batches. Once each batch is full or the flush interval is reached, the current batch is sent using the PutLogEvents API to Amazon CloudWatch.

When concurrency is enabled, the pusher uses a shared worker pool to allow multiple concurrent sends.

                               Target #1 (Log Group/Stream)                               ┌──Shared Worker Pool──┐
           ┌──────────────────────────────────────────────────────────────────┐           │                      │
           │                                                                  │           │    ┌──Worker 1──┐    │
           │    ┌────────Event Queue────────┐      ┌─────────Batch─────────┐  │           │    │ ┌────────┐ │    │
           │    │                           │      │ ┌───────────────────┐ │  │    ┌──────┼───►│ │ Sender │ │    │
           │    │ ┌───┐     ┌───┐┌───┐┌───┐ │      │ │                   │ │  │    │      │    │ └────────┘ │    │
AddEvent───│───►│ │ n │ ... │ 3 ││ 2 ││ 1 │ ├─────►│ │ PutLogEventsInput │ ├──┼────┤      │    └────────────┘    │
           │    │ └───┘     └───┘└───┘└───┘ │      │ │                   │ │  │    │      │                      │
           │    │                           │      │ └───────────────────┘ │  │    │      │    ┌──Worker 2──┐    │
           │    └───────────────────────────┘      └───────────────────────┘  │    │      │    │ ┌────────┐ │    │
           │                                                                  │    ┼──────┼───►│ │ Sender │ │    │
           └──────────────────────────────────────────────────────────────────┘    │      │    │ └────────┘ │    │
                                                                                   │      │    └────────────┘    │
                                                                                   │      │                      │
                               Target #2 (Log Group/Stream)                        │      │          .           │
           ┌──────────────────────────────────────────────────────────────────┐    │      │          .           │
           │                                                                  │    │      │          .           │
           │    ┌────────Event Queue────────┐      ┌─────────Batch─────────┐  │    │      │                      │
           │    │                           │      │ ┌───────────────────┐ │  │    │      │                      │
           │    │ ┌───┐     ┌───┐┌───┐┌───┐ │      │ │                   │ │  │    │      │    ┌──Worker n──┐    │
AddEvent───│───►│ │ n │ ... │ 3 ││ 2 ││ 1 │ ├─────►│ │ PutLogEventsInput │ ├──┼────┤      │    │ ┌────────┐ │    │
           │    │ └───┘     └───┘└───┘└───┘ │      │ │                   │ │  │    └──────┼───►│ │ Sender │ │    │
           │    │                           │      │ └───────────────────┘ │  │           │    │ └────────┘ │    │
           │    └───────────────────────────┘      └───────────────────────┘  │           │    └────────────┘    │
           │                                                                  │           │                      │
           └──────────────────────────────────────────────────────────────────┘           └──────────────────────┘

Documentation

Index

Constants

View Source
const (
	LogGroupNameTag   = "log_group_name"
	LogStreamNameTag  = "log_stream_name"
	LogGroupClassTag  = "log_group_class"
	LogTimestampField = "log_timestamp"
	LogEntryField     = "value"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudWatchLogs

type CloudWatchLogs struct {
	Region           string `toml:"region"`
	RegionType       string `toml:"region_type"`
	Mode             string `toml:"mode"`
	EndpointOverride string `toml:"endpoint_override"`
	AccessKey        string `toml:"access_key"`
	SecretKey        string `toml:"secret_key"`
	RoleARN          string `toml:"role_arn"`
	Profile          string `toml:"profile"`
	Filename         string `toml:"shared_credential_file"`
	Token            string `toml:"token"`

	//log group and stream names
	LogStreamName string `toml:"log_stream_name"`
	LogGroupName  string `toml:"log_group_name"`

	// Retention for log group
	RetentionInDays int `toml:"retention_in_days"`
	Concurrency     int `toml:"concurrency"`

	ForceFlushInterval internal.Duration `toml:"force_flush_interval"` // unit is second

	Log telegraf.Logger `toml:"-"`
	// contains filtered or unexported fields
}

func (*CloudWatchLogs) Close

func (c *CloudWatchLogs) Close() error

func (*CloudWatchLogs) Connect

func (c *CloudWatchLogs) Connect() error

func (*CloudWatchLogs) CreateDest

func (c *CloudWatchLogs) CreateDest(group, stream string, retention int, logGroupClass string, logSrc logs.LogSrc) logs.LogDest

func (*CloudWatchLogs) Description

func (c *CloudWatchLogs) Description() string

Description returns a one-sentence description on the Output

func (*CloudWatchLogs) SampleConfig

func (c *CloudWatchLogs) SampleConfig() string

SampleConfig returns the default configuration of the Output

func (*CloudWatchLogs) Write

func (c *CloudWatchLogs) Write(metrics []telegraf.Metric) error

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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