insertutils

package
v0.26.0-victorialogs Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MaxLineSizeBytes is the maximum length of a single line for /insert/* handlers
	MaxLineSizeBytes = flagutil.NewBytes("insert.maxLineSizeBytes", 256*1024, "The maximum size of a single line, which can be read by /insert/* handlers")

	// 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")
)

Functions

func ExtractTimestampRFC3339NanoFromFields added in v1.97.7

func ExtractTimestampRFC3339NanoFromFields(timeField string, fields []logstorage.Field) (int64, error)

ExtractTimestampRFC3339NanoFromFields extracts RFC3339 timestamp in nanoseconds from the field with the name timeField at fields.

The value for the timeField is set to empty string after returning from the function, so it could be ignored during data ingestion.

The current timestamp is returned if fields do not contain a field with timeField name or if the timeField value is empty.

Types

type BenchmarkLogMessageProcessor added in v1.97.7

type BenchmarkLogMessageProcessor struct{}

BenchmarkLogMessageProcessor implements LogMessageProcessor for benchmarks.

func (*BenchmarkLogMessageProcessor) AddRow added in v1.97.7

func (blp *BenchmarkLogMessageProcessor) AddRow(_ int64, _ []logstorage.Field)

AddRow implements LogMessageProcessor interface.

func (*BenchmarkLogMessageProcessor) MustClose added in v1.97.7

func (blp *BenchmarkLogMessageProcessor) MustClose()

MustClose implements LogMessageProcessor interface.

type CommonParams

type CommonParams struct {
	TenantID     logstorage.TenantID
	TimeField    string
	MsgField     string
	StreamFields []string
	IgnoreFields []string

	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 added in v1.97.7

func GetCommonParamsForSyslog(tenantID logstorage.TenantID) *CommonParams

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

func (*CommonParams) NewLogMessageProcessor added in v1.97.7

func (cp *CommonParams) NewLogMessageProcessor() LogMessageProcessor

NewLogMessageProcessor returns new LogMessageProcessor for the given cp.

type LogMessageProcessor added in v1.97.7

type LogMessageProcessor interface {
	// AddRow must add row to the LogMessageProcessor with the given timestamp and the given fields.
	//
	// The LogMessageProcessor implementation cannot hold references to fields, since the caller can re-use them.
	AddRow(timestamp int64, fields []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 TestLogMessageProcessor added in v1.97.7

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

TestLogMessageProcessor implements LogMessageProcessor for testing.

func (*TestLogMessageProcessor) AddRow added in v1.97.7

func (tlp *TestLogMessageProcessor) AddRow(timestamp int64, fields []logstorage.Field)

AddRow adds row with the given timestamp and fields to tlp

func (*TestLogMessageProcessor) MustClose added in v1.97.7

func (tlp *TestLogMessageProcessor) MustClose()

MustClose closes tlp.

func (*TestLogMessageProcessor) Verify added in v1.97.7

func (tlp *TestLogMessageProcessor) Verify(rowsExpected int, timestampsExpected []int64, resultExpected string) error

Verify verifies the number of rows, timestamps and results after AddRow calls.

Jump to

Keyboard shortcuts

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