Documentation ¶
Overview ¶
Package indexer processing logs and stores them for querying. This is probably confusing several concerns and needs work.
On start up, each indexer is assigned a new UUID. The indexer creates shards, collections of shard files that span a liited time duration (shardDuration). Each shard created by an indexer is assigned a UUID. Each incoming stream is assigned a UUID. A sharfile is created for each stream. Each message in a stream is assigned its ordinal position in the stream
The dataDir should be laid out as follows: dataDir/shardID/streamID.pb.log
Index ¶
- func NewArchive(opts ...ArchiveOpt) (*shardArchive, error)
- type ArchiveOpt
- type Indexer
- func (idx *Indexer) AddSource(ctx context.Context, id string, labels map[string]string) (sinks.MessageWriter, error)
- func (idx *Indexer) Close() error
- func (i *Indexer) Collect(ch chan<- prometheus.Metric)
- func (i *Indexer) Describe(ch chan<- *prometheus.Desc)
- func (idx *Indexer) GrafanaAnnotations(from, to time.Time, query string) ([]grafanasj.Annotation, error)
- func (idx *Indexer) GrafanaQuery(from, to time.Time, interval time.Duration, maxDPs int, target string) ([]grafanasj.Data, error)
- func (idx *Indexer) GrafanaQueryTable(from, to time.Time, target string) ([]grafanasj.TableColumn, error)
- func (idx *Indexer) GrafanaSearch(target string) ([]string, error)
- func (idx *Indexer) LabelValues(name string, from, to time.Time, count int) ([]string, int, error)
- func (idx *Indexer) Labels(from, to time.Time) ([]string, error)
- func (idx *Indexer) Search(ctx context.Context, msgFunc logspray.MessageFunc, matcher ql.MatchFunc, ...) error
- type MessageWriter
- type Opt
- type Shard
- type ShardFile
- type ShardFileByStartTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewArchive ¶
func NewArchive(opts ...ArchiveOpt) (*shardArchive, error)
Types ¶
type ArchiveOpt ¶
type ArchiveOpt func(a *shardArchive) (*shardArchive, error)
func WithArchiveDataDir ¶
func WithArchiveDataDir(datadir string) ArchiveOpt
func WithArchiveEncryptTo ¶
func WithArchiveEncryptTo(ent []openpgp.Entity) ArchiveOpt
func WithArchiveGzipCompression ¶
func WithArchiveGzipCompression(level int) ArchiveOpt
func WithArchiveRetention ¶
func WithArchiveRetention(d time.Duration) ArchiveOpt
func WithArchiveStowConfig ¶
func WithArchiveStowConfig(scfg stow.ConfigMap) ArchiveOpt
type Indexer ¶
Indexer implements a queryable index for storage of logspray mssages.
func (*Indexer) AddSource ¶
func (idx *Indexer) AddSource(ctx context.Context, id string, labels map[string]string) (sinks.MessageWriter, error)
AddSource adds a new source to the remote server
func (*Indexer) Collect ¶
func (i *Indexer) Collect(ch chan<- prometheus.Metric)
Collect implements the prom metrics collection Collector interface
func (*Indexer) Describe ¶
func (i *Indexer) Describe(ch chan<- *prometheus.Desc)
Describe implements the prometheus describe interfaces for metric collection
func (*Indexer) GrafanaAnnotations ¶
func (idx *Indexer) GrafanaAnnotations(from, to time.Time, query string) ([]grafanasj.Annotation, error)
GrafanaAnnotations implements the grafana Simple JSON Annotations request
func (*Indexer) GrafanaQuery ¶
func (idx *Indexer) GrafanaQuery(from, to time.Time, interval time.Duration, maxDPs int, target string) ([]grafanasj.Data, error)
GrafanaQuery implements the Grafana Simple JSON Query request
func (*Indexer) GrafanaQueryTable ¶ added in v0.2.3
func (idx *Indexer) GrafanaQueryTable(from, to time.Time, target string) ([]grafanasj.TableColumn, error)
GrafanaQueryTable implements the Grafana Simple JSON Query request for tables
func (*Indexer) GrafanaSearch ¶
GrafanaSearch implements the Grafana Simple JSON search query
func (*Indexer) LabelValues ¶
LabelValues returns all the known values for a given label.
type MessageWriter ¶
type MessageWriter struct {
// contains filtered or unexported fields
}
MessageWriter is a sinks.MessageWriter that writes to a remote server
func (*MessageWriter) WriteMessage ¶
WriteMessage writes a message to the log stream.
type Opt ¶
Opt defines an index option function.
func WithDataDir ¶
WithDataDir lets you set the base filesystem path to store data to.
func WithSharDuration ¶
WithSharDuration allows you to set the time duration of a shard.
type Shard ¶
type Shard struct {
// contains filtered or unexported fields
}
Shard represents a logging session.
func (*Shard) LabelValues ¶
LabelValues returns all the known values for a given label.
type ShardFile ¶
ShardFile represents an individual stream of data in a shard.
func (*ShardFile) Search ¶
func (s *ShardFile) Search(ctx context.Context, msgFunc logspray.MessageFunc, matcher ql.MatchFunc, from, to time.Time, count, offset uint64, reverse bool) error
Search searches the shard file for messages in the provided time range, matched by matcher, and passes them to msgFunc. If the reverse is true the file will be searched in reverse order
type ShardFileByStartTime ¶ added in v0.2.0
type ShardFileByStartTime []*ShardFile
func (ShardFileByStartTime) Len ¶ added in v0.2.0
func (so ShardFileByStartTime) Len() int
func (ShardFileByStartTime) Less ¶ added in v0.2.0
func (so ShardFileByStartTime) Less(i, j int) bool
func (ShardFileByStartTime) Swap ¶ added in v0.2.0
func (so ShardFileByStartTime) Swap(i, j int)