Skip to content

Conversation

@btrieger
Copy link

@btrieger btrieger commented Oct 16, 2025

What does this PR do?

This PR adds in the Logstash output for elastic agents to the standalone helm chart.

Why is it important?

Without this, standalone agents cannot connect to Logstash clusters. This makes the chart unusable for end users who have logstash in between agent and elasticsearch.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

Disruptive User Impact

This should have no user impact and be backward compatable.

How to test this PR locally

Follow steps in examples/kubernetes-logstash-output

Related issues

@btrieger btrieger requested a review from a team as a code owner October 16, 2025 19:52
@mergify
Copy link
Contributor

mergify bot commented Oct 16, 2025

This pull request does not have a backport label. Could you fix it @btrieger? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label that automatically backports to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@cmacknz cmacknz added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Oct 16, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@pierrehilbert
Copy link
Contributor

pierrehilbert commented Oct 17, 2025

Hey @btrieger
Thanks for your contribution.
Could you please add a changelog fragment?

@btrieger
Copy link
Author

@pierrehilbert added the changelog fragment

@btrieger
Copy link
Author

I added the remaining ssl flags and they should work with any of the outputs. I didn't provide an example of using them as I don't have a functioning logstash cluster that needs them but I did validate that they are being set as expected with a template command. Was thinking maybe I could document all the possible input variables outside the values schema json for every day users. Would it be best to put this in the examples readme for logstash?

On a side note the rest of the outputs should remove the fromYaml and toYaml around the the call to the SSLConfig rendering as it removes the quotes and in the case of ca fingerprints this could prove problematic.

Copy link
Contributor

@pkoutsovasilis pkoutsovasilis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the contribution @btrieger . This is a big one so I will have to go through that one more time but in the meantime I left some comments. Also please any change that you do for the k8s templates try to introduce it also for the eck ones, from what I can tell everything here is compatible with both

@btrieger
Copy link
Author

@pkoutsovasilis will do I was tyring to keep it small but it seemed kind of unavoidable if I wanted to add all the variables available for logstash.

@swiatekm swiatekm self-requested a review November 12, 2025 16:47
@swiatekm
Copy link
Contributor

@btrieger is it possible to do a basic integration test in a Kubernetes cluster? We have tooling for setting up a cluster and a ESS stack, so we'd need to start logstash with the right configuration, have agent ship to logstash, and verify if we see the data in ES. Would that be a lot of work, in your view?

@btrieger
Copy link
Author

@swiatekm it shouldn't be to bad. Where is the tooling located? I have run it all locally and confirmed it is working so I have the k8s manifests

@swiatekm
Copy link
Contributor

@btrieger have a look at

func TestKubernetesAgentHelm(t *testing.T) {
. You can even skip sending the data and just demonstrate that agent is healthy with a logstash output.

@btrieger
Copy link
Author

btrieger commented Dec 1, 2025

@swiatekm I added a logstash test. Let me know your thoughts.

Copy link
Contributor

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test looks good to me, minus the rather involved health check. Does it really need to be so complicated?

Comment on lines 1308 to 1344
// Check Logstash API health
err := kCtx.client.Resources().ExecInPod(ctx, namespace, pod.Name, "logstash",
[]string{"curl", "-s", "localhost:9600/_node/stats"}, stdout, stderr)
if err != nil {
return false
}

var result map[string]interface{}
if err := json.Unmarshal(stdout.Bytes(), &result); err != nil {
return false
}

// Check if the pipeline is running - try multiple paths as structure may vary
if pipelines, ok := result["pipelines"].(map[string]interface{}); ok {
// Check for "main" pipeline (default name)
if main, ok := pipelines["main"].(map[string]interface{}); ok {
if workers, ok := main["workers"].(float64); ok && workers > 0 {
return true
}
}
// If there are any pipelines with workers, that's good enough
for _, pipelineData := range pipelines {
if pipelineMap, ok := pipelineData.(map[string]interface{}); ok {
if workers, ok := pipelineMap["workers"].(float64); ok && workers > 0 {
return true
}
}
}
}

// Alternative check: just verify the API is responding and has valid structure
if _, hasJVM := result["jvm"]; hasJVM {
if _, hasPipelines := result["pipelines"]; hasPipelines {
t.Logf("Logstash API is responding with pipeline data")
return true
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to do all this just to check Logstash health?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants