Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ElasticsearchClient ¶
type ElasticsearchClient struct {
// contains filtered or unexported fields
}
ElasticsearchClient Structure
func NewElasticsearchClient ¶
func NewElasticsearchClient(esURL string, esUser string, esPassword string, esCaCertPath string, esAllowInsecureTLS bool) (*ElasticsearchClient, error)
NewElasticsearchClient creates a new Elasticsearch client with the given Elasticsearch URL and kubearmor LogClient with endpoint. It has a retry mechanism for certain HTTP status codes and a backoff function for retry delays. It then creates a new NewBulkIndexer with the esClient
func (*ElasticsearchClient) PrintBulkStats ¶
func (ecl *ElasticsearchClient) PrintBulkStats()
PrintBulkStats prints data on the bulk indexing process, including the number of indexed documents, the number of errors, and the indexing rate , after elasticsearch client stops
func (*ElasticsearchClient) SendAlertToBuffer ¶
func (ecl *ElasticsearchClient) SendAlertToBuffer(alert *pb.Alert)
func (*ElasticsearchClient) Start ¶
func (ecl *ElasticsearchClient) Start(AlertsIndex string) error
Start starts the Elasticsearch client by performing a health check on the gRPC server and starting goroutines to consume messages from the alert channel and bulk index them. The method starts a goroutine for each stream and waits for messages to be received. Additional goroutines consume alert from the alert channel and bulk index them.
func (*ElasticsearchClient) Stop ¶
func (ecl *ElasticsearchClient) Stop() error
Stop stops the Elasticsearch client and performs necessary cleanup operations. It stops the Kubearmor Relay client, closes the BulkIndexer and cancels the context.