Skip to content
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

User-facing documentation for Logstash on ECK #6743

Merged
merged 53 commits into from
May 10, 2023
Merged

Conversation

robbavey
Copy link
Member

@robbavey robbavey commented Apr 28, 2023

This PR includes documentation for Logstash on ECK.

Includes:

  • Quickstart guide
  • How to Configure Logstash on ECK, including
    • Logstash Configuration
    • Pipeline Configuration
    • Using ElasticsearchRef
    • Exposing services
    • Sample recipes for configuring pipelines in different ways
    • Advanced Configuration - setting JVM options
    • Limitations of the Technical Preview

DOC PREVIEW: https://cloud-on-k8s_6743.docs-preview.app.elstc.co/guide/en/cloud-on-k8s/master/k8s-logstash.html

robbavey and others added 30 commits March 6, 2023 12:16
* Initial Commit of ECK for Logstash

Initial commit of a simple operator.

The first operator will create:
* A Service exposing the logstash metrics API, so it can be used for monitoring purposes, with the option to expose further services if necessary
* Secrets holding logstash.yml
* A StatefulSet deploying the logstash pods
* Pods with default readiness probe

The sample logstash yml file as located in config/samples/logstash/logstash_svc.yaml will
create:

```
✗ kubectl tree logstash logstash-sample
NAMESPACE  NAME                                                READY  REASON  AGE 
default    Logstash/logstash-sample                            -              7m3s
default    ├─Secret/logstash-sample-ls-config                  -              7m3s
default    ├─Service/logstash-sample-ls-api                    -              7m3s
default    │ └─EndpointSlice/logstash-sample-ls-api-4dl2x      -              7m3s
default    ├─Service/logstash-sample-ls-beats                  -              7m3s
default    │ └─EndpointSlice/logstash-sample-ls-beats-rw8sp    -              7m3s
default    ├─Service/logstash-sample-ls-default                -              7m3s
default    │ └─EndpointSlice/logstash-sample-ls-default-6vmhp  -              7m3s
default    └─StatefulSet/logstash-sample-ls                    -              7m3s
default      ├─ControllerRevision/logstash-sample-ls-86448964  -              7m3s
default      ├─Pod/logstash-sample-ls-0                        True           7m3s
default      ├─Pod/logstash-sample-ls-1                        True           7m3s
default      └─Pod/logstash-sample-ls-2                        True           7m3s```

And shows status:

```
✗ kubectl get logstash logstash-sample
NAME              AVAILABLE   EXPECTED   AGE     VERSION
logstash-sample   2           2          2m35s   8.6.1
```

Co-authored-by: Kaise Cheng <[email protected]>
Co-authored-by: kaisecheng <[email protected]>
Co-authored-by: Peter Brachwitz <[email protected]>
Co-authored-by: Michael Morello <[email protected]>
Following the prior art, this commit integrates stack monitoring for Logstash by adding metricsbeat and filebeat as sidecars to deliver metrics and log to monitoring es cluster

There is a sample resource in config/samples/logstash/logstash_stackmonitor.yaml to deploy and test.

Co-authored-by: Rob Bavey <[email protected]>
Co-authored-by: Michael Morello <[email protected]>
This PR allows configuration of Logstash pipeline.yml in CRD. pipeline.yml is an array of map of string/interface{} defining multiple pipelines. `.` in between the key is treated as string. Pipelines can be set from either inline in Pipelines or secret referencing in PipelinesRef.

e2e test: TestPipelineConfigRefLogstash, TestPipelineConfigLogstash

Co-authored-by: Rob Bavey <[email protected]>
Co-authored-by: Michael Morello <[email protected]>
This commit adds extra unit tests for the Logstash Controller, including tests for config, controller, pods and services
…pod restart (elastic#6674)

This commit adds the ability to reload logstash pipelines when the pipeline changes, without triggering a full restart of the pod, leveraging Logstash's ability to watch pipeline definitions, and reload automatically if a change is discovered.

A logstash config directory typically includes logstash.yml, pipelines.yml, jvm.options and log4j2.properties required to run logstash - while logstash can store the contents of a pipeline definition in any location, the pipelines.yml definition file, which states where these definition files are must be in the same config directory as the other setup files.

To enables us to have a mixture of copied and generated files in this config directory, an initContainer is used, with a small script to prepare the config directory.

The script copies the contents of the /usr/share/logstash/config into the a shared config volume
Additionally softlinks are created into this volume from the pipelines.yml and logstash.yml secrets created by the logstash operator.
Additionally, we now do not include changes to pipelines in the configuration hash that triggers a pod reload, but instead write the config.reload.automatic: true setting in to logstash.yml


Co-authored-by: Peter Brachwitz <[email protected]>
Co-authored-by: Thibault Richard <[email protected]>
This commit adds information about Logstash to the set of ECK telemetry 
Co-authored-by: Thibault Richard <[email protected]>
Fix Logstash service e2e tests

This test was failing, because the readiness probe was hitting the port defined by the service
rather than the default port. This commit updates the e2e test to set the config to
serve the logstash api from the same port that the service specifies.


Co-authored-by: Michael Morello <[email protected]>
This commit allows configuration of `elasticsearchRefs` in CRD to associate Elasticsearch clusters to Logstash. The connectivity info/ credentials are passed via environment variable to Logstash container for referencing in Logstash plugins: logstash-output-elasticsearch, logstash-input-elasticsearch and logstash-filter-elasticsearch. Environment variables taking `$clusterName_ES_` as a prefix are available.

Co-authored-by: Michael Morello <[email protected]>
Co-authored-by: Rob Bavey <[email protected]>
Co-authored-by: Peter Brachwitz <[email protected]>
…ic#6731)

* Fix the sample tests for logstash service and stack monitoring

The stack monitoring tests were failing as the builder was not creating the monitoring
elasticsearch references. This was added, as well as a minor refactoring to split the builder
into adding metrics and logging monitoring separately.

This commit also calculates the the monitoring assocation counts correctly, as previously
the metrics association was double counted.

This commit also fixes the logstash service sample end to end test - the pipeline id in the
yaml definition did not match that in the test.

Co-authored-by: Michael Morello <[email protected]>
Still a work in progress - will need elasticsearchRef to work fully
@robbavey
Copy link
Member Author

robbavey commented May 3, 2023

@pebrc @thbkrkr @barkbay @alaudazzi @karenzone @mashhurs @kaisecheng This is ready for another round of reviews.

Thanks!

Copy link
Contributor

@kaisecheng kaisecheng left a comment

Choose a reason for hiding this comment

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

I left some suggestions and comments. The "Scaling Logstash" part is awesome. Overall doc looks pretty complete and informative.

config/recipes/logstash/logstash-eck.yaml Outdated Show resolved Hide resolved
config/recipes/logstash/logstash-monitored.yaml Outdated Show resolved Hide resolved
config/recipes/logstash/logstash-multi.yaml Outdated Show resolved Hide resolved
config/recipes/logstash/logstash-pipeline-as-secret.yaml Outdated Show resolved Hide resolved
config/recipes/logstash/logstash-pipeline-as-volume.yaml Outdated Show resolved Hide resolved
count: 3
config:
# This setting has performance implications. See the README for more details.
node.store.allow_mmap: false
Copy link
Contributor

Choose a reason for hiding this comment

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

optional: it will be great to also see elasticsearch and kibana metrics in stack monitoring. This also makes sure Logstash metrics show in UI

Copy link
Contributor

@kaisecheng kaisecheng left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Contributor

@karenzone karenzone left a comment

Choose a reason for hiding this comment

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

Left some comments and answers inline. Otherwise, LGTM!
Fantastic work on this.

@robbavey
Copy link
Member Author

robbavey commented May 9, 2023

@alaudazzi @pebrc @thbkrkr @barkbay - this docs PR has been approved on the Logstash side by our tech writer @karenzone and is ready for final review from the cloud team.

Thanks!

Copy link
Collaborator

@pebrc pebrc left a comment

Choose a reason for hiding this comment

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

LGTM @barkbay should we merge and back port to 2.8?

@barkbay barkbay added the v2.8.0 label May 10, 2023
@barkbay
Copy link
Contributor

barkbay commented May 10, 2023

LGTM @barkbay should we merge and back port to 2.8?

Yes, release related label added (it will help me to [check/take care about] backports).

@pebrc
Copy link
Collaborator

pebrc commented May 10, 2023

💚 All backports created successfully

Status Branch Result
2.8

Questions ?

Please refer to the Backport tool documentation

pebrc pushed a commit to pebrc/cloud-on-k8s that referenced this pull request May 10, 2023
Documentation for the technical preview of Logstash support in ECK

(cherry picked from commit 298157f)
pebrc added a commit that referenced this pull request May 10, 2023
Documentation for the technical preview of Logstash support in ECK

(cherry picked from commit 298157f)

Co-authored-by: Rob Bavey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants