Enhancement: Add API to reload a single pipeline#18832
Open
mhunsber wants to merge 4 commits intoelastic:mainfrom
Open
Enhancement: Add API to reload a single pipeline#18832mhunsber wants to merge 4 commits intoelastic:mainfrom
mhunsber wants to merge 4 commits intoelastic:mainfrom
Conversation
Contributor
🤖 GitHub commentsJust comment with:
|
Contributor
|
This pull request does not have a backport label. Could you fix it @mhunsber? 🙏
|
Author
I do not have the permissions to add a label to the PR. However, I had been running this change successfully in Logstash version 7.x, so it should be compatible with any of the previous versions of Logstash. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change:
Release notes
_node/pipeline/:id/_reload.What does this PR do?
This commit exposes a new endpoint in the logstash node API for pipelines/[pipeline_id]/_reload, which uses the Logstash agent to issue a new LogStash::PipelineAction::Reload action.
Why is it important/What is the impact to the user?
Addresses a feature request in #11837. There are times when it is necessary to forcefully restart a pipeline without making changes to the configuration. The SIGHUB signal will reload all pipelines, but cannot be used to only reload one. It is also possible to modify the file of a pipeline config, but this only works when using file-based pipeline configuration.
Checklist
How to test this PR locally
bin/logstash -e 'input { file { path => "/dev/null" }} output { file { path => "/dev/null" } }'curl -X POST http://localhost:9600/_node/pipelines/main/_reloadRelated issues
Use cases
Given a pipeline uses a ruby script file, when a user modifies the ruby script file, then the API can be called so that the pipeline reloads.
Given a pipeline has failed due to a downstream dependency, then the pipeline can be reloaded without restarting all of Logstash. - from Cameron Kerr: #11837 (comment)
I have been using this change in deployments of Logstash that I had managed for over 5 years without issues. I had several ruby scripts that would need updated, but was using the builtin Pipeline Management through the Kibana UI, so I could not modify the pipeline configuration to trigger a reload.
Logs
bin/logstash -e 'input { file { path => "/dev/null" }} output { file { path => "/dev/null" } }'{ "host": "**************", "version": "9.4.0", "http_address": "127.0.0.1:9600", "id": "7984d429-62e3-4e36-aaa9-9773b8acc5ee", "name": "solardrip", "ephemeral_id": "dc9173ea-0ce9-465b-a0d4-ab68d1980714", "snapshot": null, "status": "green", "pipeline": { "workers": 12, "batch_size": 125, "batch_delay": 50 }, "success": true, "failed_actions": [], "successful_actions": [ { "id": "main", "action_type": "LogStash::PipelineAction::Reload" } ] }