Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.
func ParseUnixTimestamp ¶ added in v1.97.9
ParseUnixTimestamp parses s as unix timestamp in either seconds or milliseconds and returns the parsed timestamp in nanoseconds.
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 MsgFields []string StreamFields []string IgnoreFields []string ExtraFields []logstorage.Field 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, streamFields, ignoreFields []string, extraFields []logstorage.Field) *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(protocolName string) LogMessageProcessor
NewLogMessageProcessor returns new LogMessageProcessor for the given cp.
MustClose() must be called on the returned LogMessageProcessor when it is no longer needed.
type LineReader ¶ added in v1.97.14
type LineReader struct { // Line contains the next line read after the call to NextLine Line []byte // contains filtered or unexported fields }
LineReader reads newline-delimited lines from the underlying reader
func NewLineReader ¶ added in v1.97.14
func NewLineReader(name string, r io.Reader) *LineReader
NewLineReader returns LineReader for r.
func (*LineReader) Err ¶ added in v1.97.14
func (lr *LineReader) Err() error
Err returns the last error after NextLine call.
func (*LineReader) NextLine ¶ added in v1.97.14
func (lr *LineReader) NextLine() bool
NextLine reads the next line from the underlying reader.
It returns true if the next line is successfully read into Line. If the line length exceeds MaxLineSizeBytes, then this line is skipped and an empty line is returned instead.
If false is returned, then no more lines left to read from r. Check for Err in this case.
type LogMessageProcessor ¶ added in v1.97.7
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 re-use 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 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, streamFields []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.