filterdate

package
v0.0.0-...-5039c01 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 9 Imported by: 1

README

gogstash date filter module

Synopsis

filter:
  - type: date
    # (required) data format
    format: ["02/Jan/2006:15:04:05 -0700"]
    # (required) source field
    source: time_local
    # (optional) using joda time format, eg. "YYYY-MM-dd HH:mm:ss,SSS", default: false
    joda: false
    # (optional) target field. default: @timestamp
    target: mytimestamp

There are two special source formats:

  • UNIX
  • UNIXNANO

With these formats, the source is parsed and treated to be in unix time format with second or nanosecond precision.

Documentation

Index

Constants

View Source
const DefaultTarget = "@timestamp"

DefaultTarget default event field to store date as

View Source
const ErrorTag = "gogstash_filter_date_error"

ErrorTag tag added to event when process module failed

View Source
const ModuleName = "date"

ModuleName is the name used in config file

Variables

This section is empty.

Functions

func InitHandler

func InitHandler(
	ctx context.Context,
	raw config.ConfigRaw,
	control config.Control,
) (config.TypeFilterConfig, error)

InitHandler initialize the filter plugin

Types

type FilterConfig

type FilterConfig struct {
	config.FilterConfig

	Format               []string `json:"format"`                  // date parse format
	Source               string   `json:"source"`                  // source message field name
	Joda                 bool     `json:"joda"`                    // whether using joda time format
	Target               string   `json:"target"`                  // target field where date should be stored
	ComputeYearIfMissing bool     `json:"compute_year_if_missing"` // try to find missing year; dont support logs older than 1 year
	// contains filtered or unexported fields
}

FilterConfig holds the configuration json fields and internal objects

func DefaultFilterConfig

func DefaultFilterConfig() FilterConfig

DefaultFilterConfig returns an FilterConfig struct with default values

func (*FilterConfig) Event

Event the main filter event

Jump to

Keyboard shortcuts

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