-
Couldn't load subscription status.
- Fork 128
Logstash improvements: auto pipeline reload. #1668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
afd8bf2
caf78b4
cd84490
dee03da
75d9e6e
1209dda
f8294df
0159be7
94258b8
eaed0b5
0fb0711
a9cac49
cea200c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,38 @@ | ||||||
| #!/bin/bash | ||||||
|
|
||||||
| set -euo pipefail | ||||||
|
|
||||||
| LOGSTASH_HOME="/usr/share/logstash/" | ||||||
|
|
||||||
| # logstash expects the key in pkcs8 format. | ||||||
| # Hence converting the key.pem to pkcs8 format using openssl. | ||||||
| create_cert() { | ||||||
| ls_cert_path="$LOGSTASH_HOME/config/certs" | ||||||
| openssl pkcs8 -inform PEM -in "$ls_cert_path/key.pem" -topk8 -nocrypt -outform PEM -out "/tmp/logstash.pkcs8.key" | ||||||
| chmod 777 "/tmp/logstash.pkcs8.key" | ||||||
|
Comment on lines
+11
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit. It doesn't use to be a good practice to write a key in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good! Let me follow up Nits with separate PR because this is somehow blocking my another task: elastic/logstash-filter-elastic_integration#122 (comment) |
||||||
| } | ||||||
|
|
||||||
| # config copy is intentional that mounted volumes will be busy and cannot be overwritten | ||||||
| overwrite_pipeline_config() { | ||||||
| ls_pipeline_config_path="$LOGSTASH_HOME/pipeline/" | ||||||
| cat "$ls_pipeline_config_path/generated_logstash.conf" > "$ls_pipeline_config_path/logstash.conf" | ||||||
| } | ||||||
|
|
||||||
| # installs the given plugin if it is not installed | ||||||
| install_plugin_if_missing() { | ||||||
| plugin_name=$1 | ||||||
| if [[ ! $(bin/logstash-plugin list) == *"$plugin_name"* ]]; then | ||||||
| echo "Missing plugin $plugin_name, installing now" | ||||||
| bin/logstash-plugin install "$plugin_name" | ||||||
| fi | ||||||
| } | ||||||
|
|
||||||
| # runs Logstash | ||||||
| run() { | ||||||
| bin/logstash -f "$LOGSTASH_HOME/pipeline/logstash.conf" --config.reload.automatic | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit. Could we use exec to replace the process?
Suggested change
|
||||||
| } | ||||||
|
|
||||||
| create_cert | ||||||
| overwrite_pipeline_config | ||||||
| install_plugin_if_missing "logstash-filter-elastic_integration" | ||||||
| run | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks!