Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct { KeyAsString string `json:"key_as_string"` Key int64 `json:"key"` DocCount int64 `json:"doc_count"` }
Bucket is the structure of a bucket returned by the Elasticsearch API.
type Config ¶
type Config struct { Name string `json:"name"` DisplayName string `json:"displayName"` Description string `json:"description"` Address string `json:"address"` Username string `json:"username"` Password string `json:"password"` Token string `json:"token"` }
Config is the structure of the configuration for a single Elasticsearch instance.
type Data ¶
type Data struct { Took int64 `json:"took"` Hits int64 `json:"hits"` Documents []map[string]interface{} `json:"documents"` Buckets []Bucket `json:"buckets"` }
Data is the transformed Response result, which is passed to the React UI. It contains only the important fields, like the time a request took, the number of hits, the documents and the buckets.
type Instance ¶
type Instance struct { Name string // contains filtered or unexported fields }
Instance represents a single Elasticsearch instance, which can be added via the configuration file.
func (*Instance) GetLogs ¶
func (i *Instance) GetLogs(ctx context.Context, query string, timeStart, timeEnd int64) (*Data, error)
GetLogs returns the raw log documents and the buckets for the distribution of the logs accross the selected time range. We have to pass a query, start and end time to the function.
type Response ¶
type Response struct { ScrollID string `json:"_scroll_id"` Took int64 `json:"took"` TimedOut bool `json:"timed_out"` Shards struct { Total int64 `json:"total"` Successful int64 `json:"successful"` Skipped int64 `json:"skipped"` Failed int64 `json:"failed"` } `json:"_shards"` Hits struct { Total struct { Value int64 `json:"value"` Relation string `json:"relation"` } `json:"total"` Hits []map[string]interface{} `json:"hits"` } `json:"hits"` Aggregations struct { LogCount struct { Buckets []Bucket `json:"buckets"` } `json:"logcount"` } `json:"aggregations"` }
Response is the structure of successful Elasticsearch API call.
type ResponseError ¶
type ResponseError struct { Error struct { RootCause []struct { Type string `json:"type"` Reason string `json:"reason"` } `json:"root_cause"` Type string `json:"type"` Reason string `json:"reason"` CausedBy struct { Type string `json:"type"` Reason string `json:"reason"` } `json:"caused_by"` } `json:"error"` Status int `json:"status"` }
ResponseError is the structure of failed Elasticsearch API call.