axslogparser

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2018 License: MIT Imports: 8 Imported by: 10

README

axslogparser

Build Status Coverage Status MIT License GoDoc

Description

An accesslog parser supports apache log (common and combined) and ltsv accesslog (http://ltsv.org).

Supported Formats

  • Apache Logs (also cared in the case of using tab character as delimiter)
    • Common log format
    • Common log format with vhost
    • Combined log format
    • Combined log format with extra fields
  • LTSV Accesslog format according to http://ltsv.org

Author

Songmu

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GuessParser

func GuessParser(line string) (Parser, *Log, error)

GuessParser guesses the parser from line

Types

type Apache

type Apache struct {
}

Apache log parser

func (*Apache) Parse

func (ap *Apache) Parse(line string) (*Log, error)

Parse for Parser interface

type LTSV

type LTSV struct {
}

LTSV access log parser

func (*LTSV) Parse

func (lv *LTSV) Parse(line string) (*Log, error)

Parse for Parser interface

type Log

type Log struct {
	VirtualHost  string `ltsv:"vhost"`
	Host         string
	RemoteUser   string
	User         string
	Time         time.Time `ltsv:"-"`
	TimeStr      string    `ltsv:"time"`
	Request      string    `ltsv:"req"`
	Status       int
	Size         uint64
	Referer      string
	UserAgent    string `ltsv:"ua"`
	ReqTime      *float64
	AppTime      *float64
	TakenSec     *float64 `ltsv:"taken_sec"` // Hatena specific
	ForwardedFor string
	RequestURI   string `ltsv:"uri"`
	Protocol     string
	Method       string
}

Log is the struct stored parsed result of single line of accesslog

func Parse

func Parse(line string) (*Log, error)

Parse log line

type Parser

type Parser interface {
	Parse(string) (*Log, error)
}

Parser is the interface for accesslog

Jump to

Keyboard shortcuts

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