logs

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFBOutput

func ParseFBOutput(line string) (sanitizedLine string, agentSeverity logrus.Level)

ParseFBOutput sanitizes line (stripping FB severity and timestamp) and provides agent severity. Agent severity should be either: Debug, Warn or Error. FB-Info maps to agent-Debug. FB lines expected to be format: [2020/03/04 15:57:54] [ info] [input] pausing tail.0 2020/03/09 20:21:54 [DEBUG] Error making HTTP request. Got status code: 403

Types

type CfgLoader

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

func NewFolderLoader

func NewFolderLoader(c config.LogForward, agentIDFn id.Provide, hostnameResolver hostname.Resolver) *CfgLoader

func (*CfgLoader) GetConfigDir

func (l *CfgLoader) GetConfigDir() string

func (*CfgLoader) GetLicenseKey added in v0.1.0

func (l *CfgLoader) GetLicenseKey() string

func (*CfgLoader) LoadAll

func (l *CfgLoader) LoadAll() (c FBCfg, ok bool)

LoadAll loads and parses the logging configuration. It returns ok=false in case an error occurred, which should block the start of the log forwarding feature.

func (*CfgLoader) LoadAndFormat

func (l *CfgLoader) LoadAndFormat() (string, FBCfgExternal, error)

type ConfigChangesWatcher

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

ConfigChangesWatcher will look in a path for changes in the configuration.

func NewConfigChangesWatcher

func NewConfigChangesWatcher(path string) *ConfigChangesWatcher

NewConfigChangesWatcher creates a new instance of ConfigChangesWatcher.

func (*ConfigChangesWatcher) Watch

func (ccw *ConfigChangesWatcher) Watch(ctx ctx2.Context, changes chan<- struct{})

Watch is registering a channel to push notifications when a change in the watched path is detected.

type FBCfg

type FBCfg struct {
	Inputs      []FBCfgInput
	Filters     []FBCfgFilter
	ExternalCfg FBCfgExternal
	Output      FBCfgOutput
}

FBCfg FluentBit automatically generated configuration.

func NewFBConf

func NewFBConf(loggingCfgs LogsCfg, logFwdCfg *config.LogForward, entityGUID, hostname string) (fb FBCfg, e error)

NewFBConf creates a FluentBit config from several logging integration configs.

func (FBCfg) Format

func (c FBCfg) Format() (result string, externalCfg FBCfgExternal, err error)

Format will return the FBCfg in the fluent bit config file format.

type FBCfgExternal

type FBCfgExternal struct {
	CfgFilePath     string
	ParsersFilePath string
}

FBCfgExternal represents an existing set of native FluentBit configuration files that should be merged with the auto-generated FB configuration

type FBCfgFilter

type FBCfgFilter struct {
	Name      string
	Match     string
	Regex     string            // plugin: grep
	Records   map[string]string // plugin: record_modifier
	Script    string            // plugin:lua-Script
	Call      string            // plugin:lua-Script
	Modifiers map[string]string //plugin: modify filter
}

FBCfgFilter FluentBit FILTER config block, only "grep" plugin supported.

[FILTER]
  Name   grep
  Match  nri-service
  Regex  MESSAGE info

type FBCfgInput

type FBCfgInput struct {
	Name                  string
	Tag                   string
	DB                    string
	Path                  string // plugin: tail
	BufferMaxSize         string // plugin: tail
	PathKey               string // plugin: tail
	SkipLongLines         string // always on
	Systemd_Filter        string // plugin: systemd
	Channels              string // plugin: winlog
	SyslogMode            string // plugin: syslog
	SyslogListen          string // plugin: syslog
	SyslogPort            int    // plugin: syslog
	SyslogParser          string // plugin: syslog
	SyslogUnixPath        string // plugin: syslog
	SyslogUnixPermissions string // plugin: syslog
	BufferChunkSize       string // plugin: syslog udp/udp_unix
	TcpListen             string // plugin: tcp
	TcpPort               int    // plugin: tcp
	TcpFormat             string // plugin: tcp
	TcpSeparator          string // plugin: tcp
	TcpBufferSize         int    // plugin: tcp (note that the "tcp" plugin uses Buffer_Size (without "k"s!) instead of Buffer_Max_Size (with "k"s!))
}

FBCfgInput FluentBit INPUT config block for either "tail", "systemd", "winlog", "winevtlog" or "syslog" plugins. Tail plugin expected shape:

[INPUT]
  Name tail
  Path /var/log/newrelic-infra/newrelic-infra.log
  Tag  nri-file
  DB   fb.db

Systemd plugin expected shape: [INPUT]

Name           systemd
Systemd_Filter _SYSTEMD_UNIT=newrelic-infra.service
Tag            newrelic-infra
DB             fb.db

type FBCfgOutput

type FBCfgOutput struct {
	Name              string
	Match             string
	LicenseKey        string
	Endpoint          string // empty for US, value required for EU or staging
	IgnoreSystemProxy bool
	Proxy             string
	CABundleFile      string
	CABundleDir       string
	ValidateCerts     bool
	Retry_Limit       string
}

FBCfgOutput FluentBit Output config block, supporting NR output plugin. https://github.com/newrelic/newrelic-fluent-bit-output

type FBWinlogLuaScript

type FBWinlogLuaScript struct {
	FnName           string
	ExcludedEventIds string
	IncludedEventIds string
}

func (FBWinlogLuaScript) Format

func (script FBWinlogLuaScript) Format() (result string, err error)

Format will return the formatted lua script that fluent bit config is pointing to.

type LogCfg

type LogCfg struct {
	Name       string            `yaml:"name"`
	File       string            `yaml:"file"`        // ...
	MaxLineKb  int               `yaml:"max_line_kb"` // Setup the max value of the buffer while reading lines.
	Systemd    string            `yaml:"systemd"`     // ...
	Pattern    string            `yaml:"pattern"`
	Attributes map[string]string `yaml:"attributes"`
	Syslog     *LogSyslogCfg     `yaml:"syslog"`
	Tcp        *LogTcpCfg        `yaml:"tcp"`
	Fluentbit  *LogExternalFBCfg `yaml:"fluentbit"`
	Winlog     *LogWinlogCfg     `yaml:"winlog"`
	Winevtlog  *LogWinevtlogCfg  `yaml:"winevtlog"`
}

LogCfg logging integration config from customer defined YAML.

func (*LogCfg) IsValid

func (l *LogCfg) IsValid() bool

IsValid validates struct as there's no constructor to enforce it.

type LogExternalFBCfg

type LogExternalFBCfg struct {
	CfgPath     string `yaml:"config_file"`
	ParsersPath string `yaml:"parsers_file"`
}

type LogSyslogCfg

type LogSyslogCfg struct {
	URI             string `yaml:"uri"`
	Parser          string `yaml:"parser"`
	UnixPermissions string `yaml:"unix_permissions"`
}

LogSyslogCfg logging integration config from customer defined YAML, specific for the Syslog input plugin

type LogTcpCfg

type LogTcpCfg struct {
	Uri       string `yaml:"uri"`
	Format    string `yaml:"format"`
	Separator string `yaml:"separator"`
}

type LogWinevtlogCfg

type LogWinevtlogCfg struct {
	Channel         string   `yaml:"channel"`
	CollectEventIds []string `yaml:"collect-eventids"`
	ExcludeEventIds []string `yaml:"exclude-eventids"`
}

type LogWinlogCfg

type LogWinlogCfg struct {
	Channel         string   `yaml:"channel"`
	CollectEventIds []string `yaml:"collect-eventids"`
	ExcludeEventIds []string `yaml:"exclude-eventids"`
}

type LogsCfg

type LogsCfg []LogCfg

LogsCfg stores logging product configuration split by block entries.

type YAML

type YAML struct {
	Logs LogsCfg `yaml:"logs"`
}

YAML yaml format logs config file.

Jump to

Keyboard shortcuts

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