logstasher

package
v0.0.0-...-38e557e Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExampleID_Next

func ExampleID_Next()

func Setup

func Setup(ESServer, ESIndexPrefix, ESHostname string)

Setup sets up the global variables for the package.

func Submit

func Submit(report Report)

Submit inserts a report into elasticsearch (this is basically a manual logstash).

Types

type ConnectionReport

type ConnectionReport struct {
	ReportBasic

	ConnectTime    time.Time
	DisconnectTime time.Time
	// calculated
	ConnectionDuration time.Duration

	DisconnectCode   int
	DisconnectReason string

	UsernameWasValidated bool

	RemoteAddr     net.Addr `json:"-"` // not transmitted until I can figure out data minimization
	TwitchUsername string   `json:"-"` // also not transmitted
}

func (*ConnectionReport) FillReport

func (report *ConnectionReport) FillReport() error

FillReport sets all the calculated fields, and calls esReportBasic.FillReport().

func (*ConnectionReport) ReportType

func (report *ConnectionReport) ReportType() string

type ID

type ID struct {
	High uint64
	Low  uint64
}

ID is a 128-bit ID for an elasticsearch document. Textually, it is base64-encoded. The Next() method increments the ID.

func (*ID) Next

func (id *ID) Next() ID

Next increments the ID and returns the prior state. Overflow is not checked because it's a uint64, do you really expect me to overflow that

func (ID) String

func (id ID) String() string

Text converts the ID into a base64 string.

type Report

type Report interface {
	FillReport() error
	ReportType() string

	GetID() string
	GetTimestamp() time.Time
}

Report is the interface presented to the Submit() function. FillReport() is satisfied by ReportBasic, but ReportType must always be specified.

type ReportBasic

type ReportBasic struct {
	ID        string
	Timestamp time.Time
	Host      string
}

ReportBasic is the essential fields of any report.

func (*ReportBasic) FillReport

func (report *ReportBasic) FillReport() error

FillReport sets the Host and Timestamp fields.

func (*ReportBasic) GetID

func (report *ReportBasic) GetID() string

func (*ReportBasic) GetTimestamp

func (report *ReportBasic) GetTimestamp() time.Time

Jump to

Keyboard shortcuts

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