-  
 -   Notifications  
You must be signed in to change notification settings  - Fork 13
 
logging docs: mention other sinks #471
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
   Merged  
     Merged  
 Changes from all commits
 Commits 
  Show all changes 
  26 commits   Select commit Hold shift + click to select a range 
 02047a5  Updated text and image 
  fhennig 2707338  Updated formatting 
  fhennig 61c828e  Update modules/concepts/pages/logging.adoc 
  fhennig 89c3145  more info 
  fhennig 84fee5d  Merge branch 'main' into logging-sinks 
  fhennig ca31eeb  Removed HDFS mentions 
  fhennig 00dd180  Added tutorial 
  fhennig 30c205a  link to tutorial from the concepts page 
  fhennig 15102db  Merge branch 'main' into logging-sinks 
  fhennig 7d85edb  Update modules/concepts/pages/logging.adoc 
  fhennig 11cf8e5  Update modules/tutorials/examples/logging-aggregator/main.sh 
  fhennig 6370f0f  Update modules/tutorials/examples/logging-aggregator/main.sh 
  fhennig 9ae2bec  Updated ZK manifest 
  fhennig 3464e80  Made main.sh executable 
  fhennig 402f843  Removed WebHDFS from the diagram 
  fhennig 332f86b  fixes for nightly 
  fhennig 26ae240  Merge branch 'main' into logging-sinks 
  fhennig cfe552e  Update modules/tutorials/pages/logging-vector-aggregator.adoc 
  fhennig f270655  Update modules/tutorials/pages/logging-vector-aggregator.adoc 
  fhennig 74aa6d0  Update modules/tutorials/examples/logging-aggregator/main.sh 
  fhennig 2d03125  Update modules/tutorials/examples/logging-aggregator/main.sh 
  fhennig 956e728  Changed install command 
  fhennig c1a8bbe  removed sleep in favor of server-side apply 
  fhennig 87628df  Install listener 
  fhennig 1eb2cc1  shell script improvements 
  fhennig ed39252  fixed typo 
  fhennig File filter
Filter by extension
Conversations
 Failed to load comments.  
    Loading  
 Jump to
  Jump to file  
  Failed to load files.  
    Loading  
 Diff view
Diff view
There are no files selected for viewing
   Loading  
 Sorry, something went wrong. Reload?
 Sorry, we cannot display this file.
 Sorry, this file is invalid so it cannot be displayed.
    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   
        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   
     | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #!/usr/bin/env bash | ||
|   |  ||
| echo "Installing ZooKeeper Operator" | ||
| # tag::zk-op[] | ||
| stackablectl release install -i secret -i commons -i listener -i zookeeper 23.11 | ||
| # end::zk-op[] | ||
|   |  ||
| # tag::vector-agg[] | ||
| helm install \ | ||
| --wait \ | ||
| --values vector-aggregator-values.yaml \ | ||
| vector-aggregator vector/vector | ||
| # end::vector-agg[] | ||
|   |  ||
| # tag::vector-discovery[] | ||
| kubectl apply -f vector-aggregator-discovery.yaml | ||
| # end::vector-discovery[] | ||
|   |  ||
| # tag::zk[] | ||
| kubectl apply -f zookeeper.yaml | ||
| # end::zk[] | ||
|   |  ||
| # Wait until the zookeeper-operator deployed the StatefulSet | ||
| kubectl wait \ | ||
| --for=condition=available \ | ||
| --timeout=5m \ | ||
| zookeeperclusters.zookeeper.stackable.tech/simple-zk | ||
|   |  ||
| # tag::grep[] | ||
| kubectl logs vector-aggregator-0 | grep "zookeeper.version=" | jq | ||
| # end::grep[] | ||
|   |  ||
| if [ "${PIPESTATUS[1]}" -eq 0 ] | ||
| then | ||
| echo "it worked" | ||
| else | ||
| echo "it didn't work" | ||
| fi | 
   6 changes: 6 additions & 0 deletions  6   modules/tutorials/examples/logging-aggregator/vector-aggregator-discovery.yaml          
     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   
     | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: vector-aggregator-discovery | ||
| data: | ||
| ADDRESS: vector-aggregator:6000 | 
   15 changes: 15 additions & 0 deletions  15   modules/tutorials/examples/logging-aggregator/vector-aggregator-values.yaml          
     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   
     | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| role: Aggregator | ||
| customConfig: | ||
| sources: | ||
| vector: # <1> | ||
| address: 0.0.0.0:6000 | ||
| type: vector | ||
| version: "2" | ||
| sinks: | ||
| console: # <2> | ||
| type: console | ||
| inputs: | ||
| - vector | ||
| encoding: | ||
| codec: json | ||
| target: stderr | 
   32 changes: 32 additions & 0 deletions  32   modules/tutorials/examples/logging-aggregator/zookeeper.yaml          
     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   
     | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| --- | ||
| apiVersion: zookeeper.stackable.tech/v1alpha1 | ||
| kind: ZookeeperCluster | ||
| metadata: | ||
| name: simple-zk | ||
| spec: | ||
| image: | ||
| productVersion: 3.8.0 | ||
| stackableVersion: "0.0.0-dev" | ||
| clusterConfig: | ||
| vectorAggregatorConfigMapName: vector-aggregator-discovery # <1> | ||
| servers: | ||
| roleGroups: | ||
| default: | ||
| replicas: 3 | ||
| config: | ||
| logging: # <2> | ||
| enableVectorAgent: true | ||
| containers: | ||
| vector: | ||
| file: | ||
| level: WARN | ||
| zookeeper: | ||
| console: | ||
| level: INFO | ||
| file: | ||
| level: INFO | ||
| loggers: | ||
| ROOT: | ||
| level: INFO | ||
| org.apache.zookeeper.server.NettyServerCnxn: | ||
| level: NONE | 
   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   
     | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| * xref:tutorials:index.adoc[] | ||
| ** xref:end-to-end_data_pipeline_example.adoc[] | ||
| ** xref:authentication_with_openldap.adoc[] | ||
| ** xref:logging-vector-aggregator.adoc[] | ||
| ** xref:enabling_verification_of_image_signatures.adoc[] | 
   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   
        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   
     | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| = Logging with a Vector log aggregator | ||
| :description: A tutorial on how to set up a Vector log aggregator to use with the Stackable Data Platform. | ||
| :keywords: logging, observability, log aggregation, Kubernetes, k8s, Vector, ZooKeeper | ||
|   |  ||
| This tutorial teaches you how to deploy a Vector aggregator together with a product - in this case ZooKeeper - and how to configure both of them so the logs are sent from the product to the aggregator. | ||
| Logging on the Stackable Data Platform is always configured in the same way, so you can use this knowledge to configure logging in any product that you want to deploy. | ||
|   |  ||
| Prerequisites: | ||
|   |  ||
| * a k8s cluster available, or https://kind.sigs.k8s.io/[kind] installed | ||
| * xref:management:stackablectl:index.adoc[] installed | ||
| * https://helm.sh/[Helm] installed to deploy Vector | ||
| * basic knowledge of how to create resources in Kubernetes (i.e. `kubectl apply -f <filename>.yaml`) and inspect them | ||
| (`kubectl get` or a tool like https://k9scli.io/[k9s]) | ||
|   |  ||
| == Install the ZooKeeper operator | ||
|   |  ||
| Install the Stackable Operator for Apache ZooKeeper and its dependencies, so you can deploy a ZooKeeper instance later. | ||
|   |  ||
| [source,bash] | ||
| include::example$logging-aggregator/main.sh[tag=zk-op] | ||
|   |  ||
| == Install the Vector aggregator | ||
|   |  ||
| Install the Vector aggregator using Helm. | ||
| First, create a `vector-aggregator-values.yaml` file with the Helm values: | ||
|   |  ||
| [source,yaml] | ||
| include::example$logging-aggregator/vector-aggregator-values.yaml[] | ||
|   |  ||
| <1> define a source of `type` `vector` which listens to incoming log messages at port 6000. | ||
| <2> define a `console` sink, logging all received logs to `stderr`. | ||
|   |  ||
| Deploy Vector with these values using Helm: | ||
|   |  ||
| [source,bash] | ||
| include::example$logging-aggregator/main.sh[tag=vector-agg] | ||
|   |  ||
| This is a minimal working configuration. The source should be defined in this way, but you can configure different sinks, depending on your needs. | ||
| You can find an https://vector.dev/docs/reference/configuration/sinks/[overview] of all sinks in the Vector documentation, specifically the https://vector.dev/docs/reference/configuration/sinks/elasticsearch/[Elasticsearch] sink might be useful, it also works when configured with OpenSearch. | ||
|   |  ||
| To make the Vector aggregator discoverable to ZooKeeper, deploy a xref:concepts:service_discovery.adoc[discovery ConfigMap] called `vector-aggregator-discovery`. | ||
| Create a file called `vector-aggregator-discovery.yaml`: | ||
|   |  ||
| [source,yaml] | ||
| include::example$logging-aggregator/vector-aggregator-discovery.yaml[] | ||
|   |  ||
| and apply it: | ||
|   |  ||
| [source,bash] | ||
| include::example$logging-aggregator/main.sh[tag=vector-discovery] | ||
|   |  ||
| == Install ZooKeeper | ||
|   |  ||
| Now that the aggregator is running, you can install a ZooKeeper cluster which is configured to send logs to the aggregator. | ||
|   |  ||
| Create a file called `zookeeper.yaml` with the following ZookeeperCluster definition: | ||
|   |  ||
| [source,yaml] | ||
| include::example$logging-aggregator/zookeeper.yaml[] | ||
|   |  ||
| <1> This is the reference to the discovery ConfigMap created in the previous step. | ||
| <2> This is the logging configuration, where logging is first enabled and then a few settings are made. | ||
|   |  ||
| and apply it: | ||
|   |  ||
| [source,bash] | ||
| include::example$logging-aggregator/main.sh[tag=zk] | ||
|   |  ||
| TIP: You can learn more about how to configure logging in a product at the xref:concepts:logging.adoc[logging concept documentation]. | ||
|   |  ||
| == Watch the logs | ||
|   |  ||
| During startup, ZooKeeper already prints out log messages. | ||
| Vector was configured to print the aggregated logs to `stderr`, so if you look at the logs of the Vector pod, you will see the ZooKeeper logs: | ||
|   |  ||
|   |  ||
| [source,bash] | ||
| include::example$logging-aggregator/main.sh[tag=grep] | ||
|   |  ||
| You should see a JSON object per ZooKeeper replica printed that looks like | ||
|   |  ||
| [source,json] | ||
| { | ||
| "cluster": "simple-zk", | ||
| "container": "zookeeper", | ||
| "file": "zookeeper.log4j.xml", | ||
| "level": "INFO", | ||
| "logger": "org.apache.zookeeper.server.ZooKeeperServer", | ||
| "message": "Server environment:zookeeper.version=3.8.0-5a02a05eddb59aee6ac762f7ea82e92a68eb9c0f, built on 2022-02-25 08:49 UTC", | ||
| "namespace": "default", | ||
| "pod": "simple-zk-server-default-0", | ||
| "role": "server", | ||
| "roleGroup": "default", | ||
| "source_type": "vector", | ||
| "timestamp": "2023-11-06T10:30:40.223Z" | ||
| } | ||
|   |  ||
| The JSON object contains a timestamp, the log message, log level and some additional information. | ||
|   |  ||
| You can see the same log line in the log output of the ZooKeeper container: | ||
|   |  ||
| [source] | ||
| kubectl logs \ | ||
| --container=zookeeper simple-zk-server-default-0 \ | ||
| | grep "zookeeper.version=" | ||
|   |  ||
| [source] | ||
| 2023-11-06 10:30:40,223 [myid:1] - INFO [main:o.a.z.Environment@98] - Server environment:zookeeper.version=3.8.0-5a02a05eddb59aee6ac762f7ea82e92a68eb9c0f, built on 2022-02-25 08:49 UTC | ||
|   |  ||
| Congratulations, this concludes the tutorial! | ||
|   |  ||
| == What's next? | ||
|   |  ||
| Look into different sink configurations which are more suited to production use in the https://vector.dev/docs/reference/configuration/sinks/[sinks overview documetation] or learn more about how logging works on the platform in the xref:concepts:logging.adoc[concepts documentation]. | 
 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.    
 
Uh oh!
There was an error while loading. Please reload this page.