Documentation
¶
Index ¶
- func CreateServiceToken(ctx context.Context, client elastictransport.Interface, service string) (string, error)
- func DeleteIndexTemplatesDataStreams(ctx context.Context, client elastictransport.Interface, name string) error
- func DeletePipelines(ctx context.Context, client elastictransport.Interface, name string) error
- func GetPipelines(ctx context.Context, client elastictransport.Interface, name string) (map[string]Pipeline, error)
- type APIKeyRequest
- type APIKeyResponse
- type CatIntData
- type DataStream
- type DataStreams
- type Documents
- func CheckForErrorsInLogs(ctx context.Context, client elastictransport.Interface, namespace string, ...) (Documents, error)
- func CheckForErrorsInLogsWithContext(ctx context.Context, client elastictransport.Interface, namespace string, ...) (Documents, error)
- func FindMatchingLogLines(ctx context.Context, client elastictransport.Interface, namespace, line string) (Documents, error)
- func FindMatchingLogLinesForAgentWithContext(ctx context.Context, client elastictransport.Interface, agentID, line string) (Documents, error)
- func FindMatchingLogLinesWithContext(ctx context.Context, client elastictransport.Interface, namespace, line string) (Documents, error)
- func GetAllLogsForIndexWithContext(ctx context.Context, client elastictransport.Interface, index string) (Documents, error)
- func GetLatestDocumentMatchingQuery(ctx context.Context, client elastictransport.Interface, ...) (Documents, error)
- func GetLogsForAgentID(ctx context.Context, client elastictransport.Interface, id string) (Documents, error)
- func GetLogsForDataset(ctx context.Context, client elastictransport.Interface, index string) (Documents, error)
- func GetLogsForDatasetWithContext(ctx context.Context, client elastictransport.Interface, index string) (Documents, error)
- func GetLogsForDatastream(ctx context.Context, client elastictransport.Interface, ...) (Documents, error)
- func GetLogsForIndexWithContext(ctx context.Context, client elastictransport.Interface, index string, ...) (Documents, error)
- func GetResultsForAgentAndDatastream(ctx context.Context, client elastictransport.Interface, dataset string, ...) (Documents, error)
- func PerformQueryForRawQuery(ctx context.Context, queryRaw map[string]interface{}, index string, ...) (Documents, error)
- type ESDoc
- type Hits
- type Index
- type Lifecycle
- type Ping
- type Pipeline
- type Template
- type TemplateResponse
- type TotalDocCount
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateServiceToken ¶
func DeleteIndexTemplatesDataStreams ¶
func DeleteIndexTemplatesDataStreams(ctx context.Context, client elastictransport.Interface, name string) error
DeleteIndexTemplatesDataStreams deletes any data streams, then associcated index templates.
func DeletePipelines ¶
DeletePipelines deletes all pipelines that match the given pattern
func GetPipelines ¶
func GetPipelines(ctx context.Context, client elastictransport.Interface, name string) (map[string]Pipeline, error)
GetPipelines returns a list of installed pipelines that match the given name/pattern
Types ¶
type APIKeyRequest ¶
type APIKeyRequest struct {
Name string `json:"name"`
Expiration string `json:"expiration"`
RoleDescriptors mapstr.M `json:"role_descriptors,omitempty"`
Metadata mapstr.M `json:"metadata,omitempty"`
}
APIKeyRequest contains the needed data to create an API key in Elasticsearch
type APIKeyResponse ¶
type APIKeyResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Expiration int `json:"expiration"`
APIKey string `json:"api_key"`
Encoded string `json:"encoded"`
}
APIKeyResponse contains the response data for an API request
func CreateAPIKey ¶
func CreateAPIKey(ctx context.Context, client elastictransport.Interface, req APIKeyRequest) (APIKeyResponse, error)
CreateAPIKey creates an API key with the given request data
type CatIntData ¶
type CatIntData int64
CatIntData represents a shard/doc/byte count in Index{}
func (*CatIntData) UnmarshalJSON ¶
func (s *CatIntData) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the custom unmarshal JSON interface kind of dumb, but ES wraps ints in quotes, so we have to manually turn them into ints
type DataStream ¶
type DataStream struct {
Name string `json:"name"`
Indicies []map[string]string `json:"indicies"`
Status string `json:"status"`
Template string `json:"template"`
Lifecycle Lifecycle `json:"lifecycle"`
Hidden bool `json:"hidden"`
System bool `json:"system"`
}
DataStream represents a data stream template
type DataStreams ¶
type DataStreams struct {
DataStreams []DataStream `json:"data_streams"`
}
DataStreams represents the response from an ES _data_stream API
func GetDataStreamsForPattern ¶
func GetDataStreamsForPattern(ctx context.Context, client elastictransport.Interface, namePattern string) (DataStreams, error)
type Documents ¶
type Documents struct {
Took int `json:"took"`
TimedOut bool `json:"timed_out"`
Hits Hits `json:"hits"`
}
Documents represents the complete response from an ES query
func CheckForErrorsInLogs ¶
func CheckForErrorsInLogs(ctx context.Context, client elastictransport.Interface, namespace string, excludeStrings []string) (Documents, error)
CheckForErrorsInLogs checks to see if any error-level lines exist excludeStrings can be used to remove any particular error strings from logs
func CheckForErrorsInLogsWithContext ¶
func CheckForErrorsInLogsWithContext(ctx context.Context, client elastictransport.Interface, namespace string, excludeStrings []string) (Documents, error)
CheckForErrorsInLogsWithContext checks to see if any error-level lines exist excludeStrings can be used to remove any particular error strings from logs
func FindMatchingLogLines ¶
func FindMatchingLogLines(ctx context.Context, client elastictransport.Interface, namespace, line string) (Documents, error)
FindMatchingLogLines returns any logs with message fields that match the given line
func FindMatchingLogLinesForAgentWithContext ¶
func FindMatchingLogLinesForAgentWithContext(ctx context.Context, client elastictransport.Interface, agentID, line string) (Documents, error)
FindMatchingLogLinesForAgentWithContext returns the matching `message` line field for an agent with the matching ID
func FindMatchingLogLinesWithContext ¶
func FindMatchingLogLinesWithContext(ctx context.Context, client elastictransport.Interface, namespace, line string) (Documents, error)
FindMatchingLogLinesWithContext returns any logs with message fields that match the given line
func GetAllLogsForIndexWithContext ¶
func GetAllLogsForIndexWithContext(ctx context.Context, client elastictransport.Interface, index string) (Documents, error)
GetAllLogsForIndexWithContext returns all logs for a given index
func GetLatestDocumentMatchingQuery ¶
func GetLatestDocumentMatchingQuery(ctx context.Context, client elastictransport.Interface, query map[string]interface{}, indexPattern string) (Documents, error)
GetLatestDocumentMatchingQuery returns the last document that matches the given query. the query field is inserted into a simple `query` POST request
func GetLogsForAgentID ¶
func GetLogsForAgentID(ctx context.Context, client elastictransport.Interface, id string) (Documents, error)
GetLogsForAgentID returns any logs associated with the agent ID
func GetLogsForDataset ¶
func GetLogsForDataset(ctx context.Context, client elastictransport.Interface, index string) (Documents, error)
GetLogsForDataset returns any logs associated with the datastream
func GetLogsForDatasetWithContext ¶
func GetLogsForDatasetWithContext(ctx context.Context, client elastictransport.Interface, index string) (Documents, error)
GetLogsForDatasetWithContext returns any logs associated with the datastream
func GetLogsForDatastream ¶
func GetLogsForDatastream( ctx context.Context, client elastictransport.Interface, dsType, dataset, namespace string) (Documents, error)
GetLogsForDatastream returns any logs associated with the datastream
func GetLogsForIndexWithContext ¶
func GetLogsForIndexWithContext(ctx context.Context, client elastictransport.Interface, index string, match map[string]interface{}) (Documents, error)
GetLogsForIndexWithContext returns any logs that match the given condition
func GetResultsForAgentAndDatastream ¶
func GetResultsForAgentAndDatastream(ctx context.Context, client elastictransport.Interface, dataset string, agentID string) (Documents, error)
GetResultsForAgentAndDatastream returns any documents match both the given agent ID and data stream
func PerformQueryForRawQuery ¶
func PerformQueryForRawQuery(ctx context.Context, queryRaw map[string]interface{}, index string, client elastictransport.Interface) (Documents, error)
PerformQueryForRawQuery executes the ES query specified by queryRaw
type ESDoc ¶
type ESDoc struct {
Index string `json:"_index"`
Score float64 `json:"_score"`
Source map[string]interface{} `json:"_source"`
}
ESDoc contains the documents returned by an ES query
type Hits ¶
type Hits struct {
Hits []ESDoc `json:"hits"`
Total TotalDocCount `json:"total"`
}
Hits returns the matching documents from an ES query
type Index ¶
type Index struct {
Health string `json:"health"`
Status string `json:"status"`
Index string `json:"index"`
UUID string `json:"uuid"`
Primary CatIntData `json:"pri"`
Replicated CatIntData `json:"rep"`
DocsCount CatIntData `json:"docs.count"`
DocsDeleted CatIntData `json:"docs.deleted"`
StoreSizeBytes CatIntData `json:"store.size"`
PrimaryStoreSizeBytes CatIntData `json:"pri.store.size"`
}
Index is the data associated with a single index from _cat/indicies
func GetAllindicies ¶
GetAllindicies returns a list of indicies on the target ES instance
func GetIndicesWithContext ¶
func GetIndicesWithContext(ctx context.Context, client elastictransport.Interface, indicies []string) ([]Index, error)
GetIndicesWithContext returns a list of indicies on the target ES instance with the provided context
type Ping ¶
type Ping struct {
Name string `json:"name"`
ClusterName string `json:"cluster_name"`
ClusterUUID string `json:"cluster_uuid"`
Version Version `json:"version"`
}
Ping returns basic ES info
type Pipeline ¶
type Pipeline struct {
Description string `json:"description"`
Processors []map[string]interface{} `json:"processors"`
}
Pipeline is an individual pipeline
type Template ¶
type Template struct {
Name string `json:"name"`
IndexTemplate map[string]interface{} `json:"index_template"`
}
Template is an individual template
type TemplateResponse ¶
type TemplateResponse struct {
IndexTemplates []Template `json:"index_templates"`
}
TemplateResponse is the body of a template data request
func GetIndexTemplatesForPattern ¶
func GetIndexTemplatesForPattern(ctx context.Context, client elastictransport.Interface, name string) (TemplateResponse, error)
GetIndexTemplatesForPattern lists all index templates on the system
type TotalDocCount ¶
TotalDocCount contains metadata for the ES response