Documentation
¶
Index ¶
- Constants
- type Aggregations
- type Aggs
- type Body
- type Bool
- type Bucket
- type Cardinality
- type CardinalityAggregation
- type ContainerCount
- type DateHistogram
- type DateHistogramAggregation
- type Elasticsearch
- func (es *Elasticsearch) ClearScroll(id string)
- func (es *Elasticsearch) CountLogsByInterval(sf logging.SearchFilter, interval string) (logging.Histogram, error)
- func (es *Elasticsearch) ExportLogs(sf logging.SearchFilter, w io.Writer) error
- func (es *Elasticsearch) GetCurrentStats(sf logging.SearchFilter) (logging.Statistics, error)
- func (es *Elasticsearch) SearchLogs(sf logging.SearchFilter, f, s int64, o string) (logging.Logs, error)
- type Hit
- type Hits
- type Kubernetes
- type LogCountOverTime
- type Match
- type Options
- type Query
- type Range
- type Response
- type Source
- type Time
Constants ¶
View Source
const ( ElasticV5 = "5" ElasticV6 = "6" ElasticV7 = "7" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregations ¶
type Aggregations struct {
ContainerCount `json:"container_count"`
LogCountOverTime `json:"log_count_over_time"`
}
type Aggs ¶
type Aggs struct {
*CardinalityAggregation `json:"container_count,omitempty"`
*DateHistogramAggregation `json:"log_count_over_time,omitempty"`
}
type Body ¶
type Body struct {
From int64 `json:"from,omitempty"`
Size int64 `json:"size,omitempty"`
Sorts []map[string]string `json:"sort,omitempty"`
*Query `json:"query,omitempty"`
*Aggs `json:"aggs,omitempty"`
}
More info: https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-search-API.html
type Bool ¶
type Bool struct {
Filter []Match `json:"filter,omitempty"`
Should []Match `json:"should,omitempty"`
MinimumShouldMatch int32 `json:"minimum_should_match,omitempty"`
}
Example: {bool: {filter: <[]Match>}} {bool: {should: <[]Match>, minimum_should_match: 1}}
type Cardinality ¶
type Cardinality struct {
Field string `json:"field,omitempty"`
}
type CardinalityAggregation ¶
type CardinalityAggregation struct {
*Cardinality `json:"cardinality,omitempty"`
}
type ContainerCount ¶
type ContainerCount struct {
Value int64 `json:"value"`
}
type DateHistogram ¶
type DateHistogramAggregation ¶
type DateHistogramAggregation struct {
*DateHistogram `json:"date_histogram,omitempty"`
}
type Elasticsearch ¶
type Elasticsearch struct {
// contains filtered or unexported fields
}
Elasticsearch implement logging interface
func NewElasticsearch ¶
func NewElasticsearch(options *Options) (*Elasticsearch, error)
func (*Elasticsearch) ClearScroll ¶
func (es *Elasticsearch) ClearScroll(id string)
func (*Elasticsearch) CountLogsByInterval ¶
func (es *Elasticsearch) CountLogsByInterval(sf logging.SearchFilter, interval string) (logging.Histogram, error)
func (*Elasticsearch) ExportLogs ¶
func (es *Elasticsearch) ExportLogs(sf logging.SearchFilter, w io.Writer) error
func (*Elasticsearch) GetCurrentStats ¶
func (es *Elasticsearch) GetCurrentStats(sf logging.SearchFilter) (logging.Statistics, error)
func (*Elasticsearch) SearchLogs ¶
func (es *Elasticsearch) SearchLogs(sf logging.SearchFilter, f, s int64, o string) (logging.Logs, error)
type Hits ¶
type Hits struct {
Total interface{} `json:"total"` // `As of Elasticsearch v7.x, hits.total is changed incompatibly
AllHits []Hit `json:"hits"`
}
type Kubernetes ¶
type LogCountOverTime ¶
type LogCountOverTime struct {
Buckets []Bucket `json:"buckets"`
}
type Match ¶
type Match struct {
*Bool `json:"bool,omitempty"`
MatchPhrase map[string]string `json:"match_phrase,omitempty"`
MatchPhrasePrefix map[string]string `json:"match_phrase_prefix,omitempty"`
Regexp map[string]string `json:"regexp,omitempty"`
*Range `json:"range,omitempty"`
}
Example: []Match [
{
bool: <Bool>
},
{
match_phrase: {
<string>: <string>
}
},
...
]
type Options ¶
type Options struct {
Host string `json:"host" yaml:"host"`
IndexPrefix string `json:"indexPrefix,omitempty" yaml:"indexPrefix"`
Version string `json:"version" yaml:"version"`
}
func NewElasticSearchOptions ¶
func NewElasticSearchOptions() *Options
type Response ¶
type Response struct {
ScrollId string `json:"_scroll_id,omitempty"`
Hits `json:"hits,omitempty"`
Aggregations `json:"aggregations,omitempty"`
}
type Source ¶
type Source struct {
Log string `json:"log"`
Time string `json:"time"`
Kubernetes `json:"kubernetes"`
}
Click to show internal directories.
Click to hide internal directories.