insertutil

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MaxFieldsPerLine is the maximum number of fields per line for /insert/* handlers
	MaxFieldsPerLine = flag.Int("insert.maxFieldsPerLine", 1000, "The maximum number of log fields per line, which can be read by /insert/* handlers; "+
		"see https://docs.victoriametrics.com/victorialogs/faq/#how-many-fields-a-single-log-entry-may-contain")
)

Functions

func CanWriteData

func CanWriteData() error

CanWriteData returns non-nil error if data cannot be written to the underlying storage.

func SetLogRowsStorage

func SetLogRowsStorage(storage LogRowsStorage)

SetLogRowsStorage sets the storage for writing data to via LogMessageProcessor.

This function must be called before using LogMessageProcessor and CanWriteData from this package.

Types

type CommonParams

type CommonParams struct {
	TenantID         logstorage.TenantID
	TimeFields       []string
	MsgFields        []string
	StreamFields     []string
	IgnoreFields     []string
	DecolorizeFields []string
	ExtraFields      []logstorage.Field

	IsTimeFieldSet  bool
	Debug           bool
	DebugRequestURI string
	DebugRemoteAddr string
}

CommonParams contains common HTTP parameters used by log ingestion APIs.

See https://docs.victoriametrics.com/victorialogs/data-ingestion/#http-parameters

func GetCommonParams

func GetCommonParams(r *http.Request) (*CommonParams, error)

GetCommonParams returns CommonParams from r.

func GetCommonParamsForSyslog

func GetCommonParamsForSyslog(tenantID logstorage.TenantID, streamFields, ignoreFields, decolorizeFields []string, extraFields []logstorage.Field) *CommonParams

GetCommonParamsForSyslog returns common params needed for parsing syslog messages and storing them to the given tenantID.

func (*CommonParams) NewLogMessageProcessor

func (cp *CommonParams) NewLogMessageProcessor(protocolName string, isStreamMode bool) LogMessageProcessor

NewLogMessageProcessor returns new LogMessageProcessor for the given cp.

MustClose() must be called on the returned LogMessageProcessor when it is no longer needed.

type InsertRowProcessor

type InsertRowProcessor interface {
	// AddInsertRow must add r to the underlying storage.
	AddInsertRow(r *logstorage.InsertRow)
}

InsertRowProcessor is used by native data ingestion protocol parser.

type LogMessageProcessor

type LogMessageProcessor interface {
	// AddRow must add row to the LogMessageProcessor with the given timestamp and fields.
	//
	// If streamFields is non-nil, then the given streamFields must be used as log stream fields instead of pre-configured fields.
	//
	// The LogMessageProcessor implementation cannot hold references to fields, since the caller can reuse them.
	AddRow(timestamp int64, fields, streamFields []logstorage.Field)

	// MustClose() must flush all the remaining fields and free up resources occupied by LogMessageProcessor.
	MustClose()
}

LogMessageProcessor is an interface for log message processors.

type LogRowsStorage

type LogRowsStorage interface {
	// MustAddRows must add lr to the underlying storage.
	MustAddRows(lr *logstorage.LogRows)

	// CanWriteData must returns non-nil error if logs cannot be added to the underlying storage.
	CanWriteData() error
}

LogRowsStorage is an interface for ingesting logs into the storage.

Jump to

Keyboard shortcuts

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