model

package
v0.0.0-...-1b9c57b Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package model provides common data types used throughout the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

type Host struct {
	ID       int64
	Name     string
	LastSeen time.Time
}

Host represents a system that we gather log records from.

func (*Host) NameShort

func (h *Host) NameShort() string

NameShort returns the Host's name without any domain name. If the Host's Name is already short, it is returned as-is.

type Record

type Record struct {
	ID      int64
	HostID  int64
	Time    time.Time
	Source  string
	Message string
	// contains filtered or unexported fields
}

Record is one record from a system log.

func (*Record) Checksum

func (r *Record) Checksum() string

Checksum returns a hash value of the record that (hopefully) uniquely identifies it.

type RecordSlice

type RecordSlice []Record

RecordSlice is a slice of Records that can be sorted.

func (RecordSlice) Len

func (r RecordSlice) Len() int

func (RecordSlice) Less

func (r RecordSlice) Less(i, j int) bool

func (RecordSlice) Swap

func (r RecordSlice) Swap(i, j int)

type Response

type Response struct {
	Timestamp time.Time
	Status    bool
	Message   string
	Payload   map[string]string
}

Response is what the Server sends to the Agent after handling a request.

type Search struct {
	ID        int64
	Timestamp time.Time
	Query     SearchQuery
	Results   []int64
	Count     int64
}

Search represents a search, including the Query and the list of IDs it returned.

type SearchQuery

type SearchQuery struct {
	Hosts   []int64          `json:"hosts"`
	Sources []string         `json:"sources"`
	Period  []time.Time      `json:"period"`
	Terms   []*regexp.Regexp `json:"terms"`
}

SearchQuery wraps the parameters for searching the log.

func (*SearchQuery) Match

func (q *SearchQuery) Match(r *Record) bool

Match checks if a given Record r matches the criteria of the SearchQuery.

Jump to

Keyboard shortcuts

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