ci: separate logs and metrics indices (#2544)

* separate logs and metrics indices

* tidy
This commit is contained in:
Moritz Sanft 2023-10-31 12:09:27 +01:00 committed by GitHub
parent 0c03076181
commit 9a282df846
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 35 deletions

View file

@ -29,33 +29,30 @@ const (
// LogstashPreparer prepares the Logstash Helm chart.
type LogstashPreparer struct {
fh file.Handler
fields map[string]string
indexPrefix string
username string
password string
port int
fh file.Handler
fields map[string]string
username string
password string
port int
templatePreparer
}
// NewLogstashPreparer returns a new LogstashPreparer.
func NewLogstashPreparer(fields map[string]string, username, password, indexPrefix string, port int) *LogstashPreparer {
func NewLogstashPreparer(fields map[string]string, username, password string, port int) *LogstashPreparer {
return &LogstashPreparer{
username: username,
password: password,
indexPrefix: indexPrefix,
fields: fields,
fh: file.NewHandler(afero.NewOsFs()),
port: port,
username: username,
password: password,
fields: fields,
fh: file.NewHandler(afero.NewOsFs()),
port: port,
}
}
// Prepare prepares the Logstash Helm chart by templating the required files and placing them in the specified directory.
func (p *LogstashPreparer) Prepare(dir string) error {
templatedPipelineConf, err := p.template(logstashAssets, "templates/pipeline.conf", pipelineConfTemplate{
InfoMap: p.fields,
Host: openSearchHost,
IndexPrefix: p.indexPrefix,
InfoMap: p.fields,
Host: openSearchHost,
Credentials: Credentials{
Username: p.username,
Password: p.password,
@ -134,7 +131,6 @@ type LogstashHelmValues struct {
type pipelineConfTemplate struct {
InfoMap map[string]string
Host string
IndexPrefix string
Credentials Credentials
Port int
}