parser

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const NginxTimeLocal = "02/Jan/2006:15:04:05 -0700"
View Source
const TypeNginx = "nginx"
View Source
const TypeNginxAccess = "nginx_access"

Variables

This section is empty.

Functions

This section is empty.

Types

type IParser

type IParser interface {
	//Parse 解析一行内容
	Parse(line *tail.Line) (map[string]interface{}, *carbon.Carbon)
	//ParseDirOrFile 解析一个目录
	ParseDirOrFile(path string) map[string][]string
	//ParseFile 解析单个文件
	ParseFile(file string) (string, string)
}

IParser Parser接口

func NewNginxAccessParser

func NewNginxAccessParser(cfg IParserConfig) IParser

NewNginxAccessParser Nginx文件处理的构造函数

func NewParser

func NewParser(cfg IParserConfig) IParser

NewParser 实例化

type IParserConfig

type IParserConfig interface {
	GetType() string
	GetTimeField() string
	GetFormat() string
}

IParserConfig Parser所需配置文件接口

type NginxAccessParser

type NginxAccessParser struct {
	VarNames  []string
	TimeFiled string
	// contains filtered or unexported fields
}

NginxAccessParser NginxAccessLog解析器

func (*NginxAccessParser) Parse

func (n *NginxAccessParser) Parse(line *tail.Line) (map[string]interface{}, *carbon.Carbon)

Parse 解析一行文件

func (*NginxAccessParser) ParseDirOrFile

func (n *NginxAccessParser) ParseDirOrFile(path string) map[string][]string

ParseDirOrFile 解析目录或文件中的文件(无递归)

func (*NginxAccessParser) ParseFile

func (n *NginxAccessParser) ParseFile(file string) (string, string)

ParseFile 识别access文件名

Jump to

Keyboard shortcuts

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