internal

package
v0.0.0-...-b643e37 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	SyslogPort      int
	QueueSize       int
	HttpPort        int
	Prefix          string
	CategoriserFile string
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(logger *log.Logger) *Application

func (*Application) ConfigureFlags

func (a *Application) ConfigureFlags() error

func (*Application) Run

func (a *Application) Run() error

type Categoriser

type Categoriser struct {
	// contains filtered or unexported fields
}

func NewCategoriser

func NewCategoriser(log *log.Logger, config []CategoriserConfig) (cr *Categoriser, err error)

func (*Categoriser) Run

func (cr *Categoriser) Run(ctx context.Context, input chan SyslogMessage, output chan NginxEvent) error

type CategoriserConfig

type CategoriserConfig struct {
	SourceRegexp string `json:"source"`
	Target       string `json:"target"`
}

type Counter

type Counter struct {
	Prefix string
	// contains filtered or unexported fields
}

func NewCounter

func NewCounter(log *log.Logger, prefix string) (c *Counter, err error)

func (*Counter) Run

func (c *Counter) Run(ctx context.Context, input chan NginxEvent) error

Run - do processing

type HttpServer

type HttpServer struct {
	HttpPort int
	// contains filtered or unexported fields
}

func NewHttpServer

func NewHttpServer(log *log.Logger, httpPort int) (hs *HttpServer, err error)

func (*HttpServer) Run

func (hs *HttpServer) Run() (err error)

type NginxEvent

type NginxEvent struct {
	Mode                   string // access / error logs
	Category               string // nginx event category
	Frontend               string
	RequestId              string `json:"request_id"`
	RequestLength          string `json:"request_length"`
	RemoteAddr             string `json:"request_addr"`
	RemoteUser             string `json:"request_user"`
	RemotePort             string `json:"remote_port"`
	Request                string `json:"request"`
	RequestUri             string `json:"request_uri"`
	RequestMethod          string `json:"request_method"`
	Args                   string `json:"args"`
	Status                 string `json:"status"`
	BodyBytesSent          string `json:"body_bytes_sent"`
	BytesSent              string `json:"bytes_sent"`
	HttpHost               string `json:"http_host"`
	ServerName             string `json:"server_name"`
	Scheme                 string `json:"scheme"`
	RequestTime            string `json:"request_time"`
	UpstreamAddr           string `json:"upstream_addr"`
	UpstreamResponseTime   string `json:"upstream_response_time"`
	UpstreamResponseLength string `json:"upstream_response_length"`
}

type Receiver

type Receiver struct {
	SyslogPort      int
	SyslogQueueSize int
	Prefix          string
	// contains filtered or unexported fields
}

func NewReceiver

func NewReceiver(log *log.Logger, syslogPort int, syslogQueueSize int, prefix string) (*Receiver, error)

func (*Receiver) Run

func (r *Receiver) Run(outputChannel chan SyslogMessage) (err error)

Run - read messages from syslog

type SyslogMessage

type SyslogMessage struct {
	Time    time.Time
	Host    string
	Message string
}

Jump to

Keyboard shortcuts

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