logging

package
v0.0.0-...-b425644 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_LOG_ROOT = "/var/log/hourly"
	HOURLY_PATTERN   = "2006/01/02/2006-01-02T15.log"
)

Variables

View Source
var TagRegexp = regexp.MustCompile("(.*?)\\[(\\d*)\\]")
View Source
var UUIDRegexp = regexp.MustCompile("([a-z0-9\\-]{36})")

Functions

func Fields

func Fields(line string) []string

func FieldsWithErr

func FieldsWithErr(line string) ([]string, error)

Types

type ElasticLoadBalancerLog

type ElasticLoadBalancerLog struct {
	Timestamp              time.Time `json:"timestamp,omitempty"`
	Elb                    string    `json:"elb,omitempty"`
	ClientAndPort          string    `json:"client_and_port,omitempty"`
	BackendAndPort         string    `json:"backend_and_port,omitempty"`
	RequestProcessingTime  float64   `json:"request_processing_time,omitempty"`
	BackendProcessingTime  float64   `json:"backend_processing_time,omitempty"`
	ResponseProcessingTime float64   `json:"response_processing_time,omitempty"`
	ElbStatusCode          int       `json:"elb_status_code,omitempty"`
	BackendStatusCode      int       `json:"backend_status_code,omitempty"`
	ReceivedBytes          int       `json:"received_bytes,omitempty"`
	SentBytes              int       `json:"sent_bytes,omitempty"`
	Method                 string    `json:"method,omitempty"`
	Url                    string    `json:"url,omitempty"`
	UserAgent              string    `json:"user_agent,omitempty"`
	SSLCipher              string    `json:"ssl_cipher,omitempty"`
	SSLProtocol            string    `json:"ssl_protocol,omitempty"`
	RAW                    string    `json:"raw,omitempty"`
}

func (*ElasticLoadBalancerLog) Load

func (l *ElasticLoadBalancerLog) Load(raw string) error

type HAProxyLine

type HAProxyLine struct {
	SyslogLine
	Frontend            string
	Backend             string
	BackendHost         string
	BackendImageId      string
	BackendContainerId  string
	Status              string
	Length              int
	ClientRequestTime   int
	ConnectionQueueTime int
	TcpConnectTime      int
	ServerResponseTime  int
	SessionDurationTime int
	ActiveConnections   int
	FrontendConnections int
	BackendConnectons   int
	ServerConnections   int
	Retries             int
	ServerQueue         int
	BackendQueue        int
	Method              string
	Uri                 string
}

func (*HAProxyLine) Parse

func (line *HAProxyLine) Parse(raw string) error

type MetrixLine

type MetrixLine struct {
	Host      string
	Metric    string
	Timestamp time.Time
	Value     int64
	Tags      MetrixTags
}

func (*MetrixLine) Parse

func (m *MetrixLine) Parse(line string) error

type MetrixTags

type MetrixTags map[string]string

type NginxLine

type NginxLine struct {
	*SyslogLine
	XForwardedFor []string `json:"x_forwarded_for,omitempty"`
	Method        string   `json:"method,omitempty"`
	Status        string   `json:"status,omitempty"`
	Length        int      `json:"length,omitempty"`
	TotalTime     float64  `json:"total_time,omitempty"`
	UnicornTime   float64  `json:"unicorn_time,omitempty"`
	HttpHost      string   `json:"http_host,omitempty"`
	UserAgentName string   `json:"user_agent_name,omitempty"`
	Uri           string   `json:"uri,omitempty"`
	Referer       string   `json:"referer,omitempty"`
	Action        string   `json:"action,omitempty"`
	Revision      string   `json:"revision,omitempty"`
	UUID          string   `json:"uuid,omitempty"`
	Etag          string   `json:"etag,omitempty"`
}

func (*NginxLine) Parse

func (line *NginxLine) Parse(raw string) error

type RailsLine

type RailsLine struct {
	Uuid             string  `json:"uuid,omitempty"`
	Action           string  `json:"action,omitempty"`
	Type             string  `json:"type,omitempty"`
	ExecutionTime    float64 `json:"execution_time,omitempty"`
	TotalTime        float64 `json:"total_time,omitempty"`
	ViewTime         float64 `json:"view_time,omitempty"`
	ActiveRecordTime float64 `json:"active_record_time,omitempty"`
}

func (*RailsLine) Parse

func (r *RailsLine) Parse(raw string) error

type RemoteLog

type RemoteLog struct {
	Host          string
	User          string
	Pattern       string
	Tail          bool
	Time          time.Time
	Compress      bool
	CustomLogRoot string
	FromBegin     bool // to be used with tail
}

func NewRemoteLogFromTime

func NewRemoteLogFromTime(host string, t time.Time, pattern string) *RemoteLog

func (*RemoteLog) CatCmd

func (rl *RemoteLog) CatCmd() string

func (*RemoteLog) Command

func (rl *RemoteLog) Command() string

func (*RemoteLog) Current

func (rl *RemoteLog) Current() string

func (*RemoteLog) GrepCmd

func (rl *RemoteLog) GrepCmd() string

func (*RemoteLog) GzipPath

func (rl *RemoteLog) GzipPath() string

func (*RemoteLog) LogRoot

func (rl *RemoteLog) LogRoot() string

func (*RemoteLog) Open

func (rl *RemoteLog) Open() (reader io.ReadCloser, e error)

func (*RemoteLog) Path

func (rl *RemoteLog) Path() string

type SyslogLine

type SyslogLine struct {
	Raw      string    `json:"raw,omitempty"`
	Time     time.Time `json:"time,omitempty"`
	Host     string    `json:"host,omitempty"`
	Tag      string    `json:"tag,omitempty"`
	Severity string    `json:"severity,omitempty"`
	Pid      int       `json:"pid,omitempty"`
	Port     string    `json:"port,omitempty"`
	Message  string    `json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*SyslogLine) Parse

func (line *SyslogLine) Parse(raw string) (e error)

func (*SyslogLine) TagString

func (line *SyslogLine) TagString(key string) string

func (*SyslogLine) Tags

func (line *SyslogLine) Tags() (t map[string]interface{})

type UnicornLine

type UnicornLine struct {
	UUID string
	SyslogLine
}

func (*UnicornLine) Parse

func (line *UnicornLine) Parse(raw string) error

Jump to

Keyboard shortcuts

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