codec

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

README

[codec] plugin grok

2017-01-02 13:58:43 INFO This is a debug Test
=>
{"level":"DEBUG","message":"This is a debug Test","time":"2017-01-02 15:58:43"}

{
    "grok": {
        "regex": "^(?P<time>[0-9]{4}-[0-9]{2}-[0-9]{2}\\s+[0-9]{2}:[0-9]{2}:[0-9]{2})\\s+(?P<level>[A-Z]{3,4})\\s+(?P<message>.*)$"
    }
}

[codec] plugin kv

2017-01-02 13:58:43||INFO||This is a debug Test => {"Level":"DEBUG","msg":"This is a debug Test","time":"2017-01-02 13:58:44", "T1": "G!" }

{
    "kv": {
        "keys": [
            [ "time", "string" ],
            [ "Level","string" ],
            [ "msg", "string" ]
        ],
        "split": "||",
        "ignore": "-",
        "tags": {
            "T1": "G!"
        },
        "geoip":"ip => geoip",
        "ipdb": "utils/GeoLite2-City.mmdb"

    }
}

说明: keys 格式为[][]string <key, type> type: string, int, int64, float64, json split: 分隔符 ignore: keys中为ignore的字段,为忽略字段 tags: 额外新增的字段 geoip: 将指定字段转换成位置格式 ipdb: GeoIP数据库地址

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddEnterHandler

type AddEnterHandler struct{}

add a enter symbol at end of line, classic written into file

func (*AddEnterHandler) Handle

func (h *AddEnterHandler) Handle(in, out []byte) (int, error)

func (*AddEnterHandler) Init

func (h *AddEnterHandler) Init(config transport.Configer) error

func (*AddEnterHandler) Version

func (h *AddEnterHandler) Version() string

type GrokHandler

type GrokHandler struct {
	Regex string `json:"regex"`

	Regexp *regexp.Regexp
}

func (*GrokHandler) Handle

func (j *GrokHandler) Handle(in, out []byte) (int, error)

func (*GrokHandler) Init

func (j *GrokHandler) Init(config transport.Configer) error

func (*GrokHandler) Version

func (j *GrokHandler) Version() string

type InjectHandler

type InjectHandler struct {
	*transport.Inject
}

add a enter symbol at end of line, classic written into file

func (*InjectHandler) Handle

func (h *InjectHandler) Handle(in, out []byte) (int, error)

func (*InjectHandler) Init

func (h *InjectHandler) Init(config transport.Configer) error

func (*InjectHandler) Version

func (h *InjectHandler) Version() string

type KVHandler

type KVHandler struct {
	Keys   [][]string             `json:"keys"`
	Split  string                 `json:"split"`
	Ignore string                 `json:"ignore"`
	GeoIP  string                 `json:"geoip"` //tell program which keys format to geoip, eg: "ip => geoip"
	IpDB   string                 `json:"ipdb"`
	Tags   map[string]interface{} `json:"tags"`
	// contains filtered or unexported fields
}

func (*KVHandler) Handle

func (kv *KVHandler) Handle(in, out []byte) (int, error)

func (*KVHandler) Init

func (kv *KVHandler) Init(config transport.Configer) error

func (*KVHandler) Version

func (kv *KVHandler) Version() string

type NullHandler

type NullHandler struct{}

direct connect input and output, do nothing

func (*NullHandler) Handle

func (h *NullHandler) Handle(in, out []byte) (int, error)

func (*NullHandler) Init

func (h *NullHandler) Init(config transport.Configer) error

func (*NullHandler) Version

func (h *NullHandler) Version() string

type ZhiziLog

type ZhiziLog struct {
	RequestId string `json:"request_id"`
	Uid       string `json:"uid"`
	ReqTime   int64  `json:"request_time"`
	Module    string `json:"module"`
	Cost      int    `json:"cost"`
	Timestamp int64  `json:"timestamp"`
	Data      string `json:"data"`
	Prefix    string `json:"Prefix"`
	MD5       string `json:"md5"`
}

type ZhiziLogFormat

type ZhiziLogFormat struct{}

Format: xxxxxxx||K1=V1&K2=V2&K3=V3...Kn=Vn test||JSON:{K1={sk1=sV1}}

func (*ZhiziLogFormat) Handle

func (d *ZhiziLogFormat) Handle(in, out []byte) (int, error)

func (*ZhiziLogFormat) Init

func (h *ZhiziLogFormat) Init(config transport.Configer) error

func (*ZhiziLogFormat) Version

func (d *ZhiziLogFormat) Version() string

Jump to

Keyboard shortcuts

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