Skip to content

Commit

Permalink
change variable and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
bhapas committed Feb 7, 2024
1 parent f284dbe commit 7cfd60b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 6 additions & 5 deletions internal/serverless/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

const (
FleetLogstshOutput = "fleet-logstash-output"
FleetLogstashOutput = "fleet-logstash-output"
)

// Project represents a serverless project
Expand Down Expand Up @@ -141,7 +141,7 @@ func (p *Project) DefaultFleetServerURL(kibanaClient *kibana.Client) (string, er
func (p *Project) AddLogstashFleetOutput(profile *profile.Profile, kibanaClient *kibana.Client) error {
logstashFleetOutput := kibana.FleetOutput{
Name: "logstash-output",
ID: FleetLogstshOutput,
ID: FleetLogstashOutput,
Type: "logstash",
Hosts: []string{"logstash:5044"},
}
Expand Down Expand Up @@ -175,10 +175,11 @@ func (p *Project) UpdateLogstashFleetOutput(profile *profile.Profile, kibanaClie
SSL: &kibana.AgentSSL{
Ca_authorities: []string{string(caFile)},
Certificate: string(certFile),
Key: string(keyFile)},
Key: string(keyFile),
},
}

if err := kibanaClient.UpdateFleetOutput(logstashFleetOutput, FleetLogstshOutput); err != nil {
if err := kibanaClient.UpdateFleetOutput(logstashFleetOutput, FleetLogstashOutput); err != nil {
return fmt.Errorf("failed to update logstash fleet output: %w", err)
}

Expand Down Expand Up @@ -252,7 +253,7 @@ func (p *Project) CreateAgentPolicy(stackVersion string, kibanaClient *kibana.Cl
}

if logstashEnabled {
policy.DataOutputID = FleetLogstshOutput
policy.DataOutputID = FleetLogstashOutput
}

newPolicy, err := kibanaClient.CreatePolicy(policy)
Expand Down
2 changes: 2 additions & 0 deletions internal/stack/_static/serverless-docker-compose.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ services:
timeout: 50s
retries: 5
# logstash expects the key in pkcs8 format. Hence converting the key.pem to pkcs8 format using openssl.
# Also logstash-filter-elastic_integration plugin is installed by default to run ingest pipelines in logstash.
# elastic-package#1637 made improvements to enable logstash stats through port 9600.
command: bash -c 'openssl pkcs8 -inform PEM -in /usr/share/logstash/config/certs/key.pem -topk8 -nocrypt -outform PEM -out /usr/share/logstash/config/certs/logstash.pkcs8.key && chmod 777 /usr/share/logstash/config/certs/logstash.pkcs8.key && if [[ ! $(bin/logstash-plugin list) == *"logstash-filter-elastic_integration"* ]]; then echo "Missing plugin logstash-filter-elastic_integration, installing now" && bin/logstash-plugin install logstash-filter-elastic_integration; fi && bin/logstash -f /usr/share/logstash/pipeline/logstash.conf'
volumes:
- "../certs/logstash:/usr/share/logstash/config/certs"
Expand Down

0 comments on commit 7cfd60b

Please sign in to comment.