storage

package
v0.0.0-...-9bdf5c2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Id           string                 `json:"id,omitempty"`
	Version      string                 `json:"version"`
	Host         string                 `json:"host"`
	ShortMessage string                 `json:"short_message"`
	FullMessage  string                 `json:"full_message,omitempty"`
	Timestamp    time.Time              `json:"timestamp"`
	Level        int32                  `json:"level,omitempty"`
	Facility     string                 `json:"facility,omitempty"`
	File         string                 `json:"file,omitempty"`
	Line         int32                  `json:"line,omitempty"`
	Extra        map[string]interface{} `json:"extra,omitempty"`
}

Custom structure needed only to convert GELF unix-timestamp to time.Time

func NewMessageFromGelf

func NewMessageFromGelf(msg *gelf.Message) *Message

Returns custom message based on GELF message structure

type SearchQuery

type SearchQuery struct {
	Query  string    `json:"query"`
	Limit  int       `json:"limit,omitempty"`
	Offset int       `json:"offset,omitempty"`
	From   time.Time `json:"from,omitempty"`
	To     time.Time `json:"to,omitempty"`
}

type SearchResult

type SearchResult struct {
	Total    int64     `json:"total"`
	TookMs   int64     `json:"took_ms"`
	Limit    int       `json:"limit"`
	Offset   int       `json:"offset"`
	Messages []Message `json:"messages"`
}

type Storage

type Storage interface {
	GetMessage(string) (map[string]interface{}, error)
	GetMessages(*SearchQuery) (*SearchResult, error)
	HandleMessage(*gelf.Message)
	PeriodicFlush(chan bool)
	ValidateQuery(string) error
}

Directories

Path Synopsis
-build
-build

Jump to

Keyboard shortcuts

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