Skip to content
This repository was archived by the owner on Apr 1, 2020. It is now read-only.

Commit 9a8baaf

Browse files
authored
Upgrades (#37)
* Update elastic stack to 6.0.0
1 parent 4e611f3 commit 9a8baaf

31 files changed

+966
-1273
lines changed

README.md

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@
22

33
See [docs](docs/index.md) for full recipe content.
44

5-
Feature comparison of the log shippers in this repo:
6-
7-
| Log Shipper | fluentd | fluent-bit | filebeat |
8-
| ----------- | ------- | ---------- | -------- |
9-
| rbac | [x](manifests/fluentd/rbac.yaml) | tbd | tbd |
10-
| metadata | [x](https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter) | tbd | tbd |
11-
125

6+
This setup is similar to the [`Full Stack Example`](https://github.com/elastic/examples/tree/master/Miscellaneous/docker/full_stack_example), but adopted to be run on a Kubernetes cluster.
137

8+
There is no access control for the Kibana web interface. If you want to run this in public you need to secure your setup. The provided manifests here are for demonstration purposes only.
149

1510

1611
# Local Setup
@@ -21,41 +16,35 @@ Feature comparison of the log shippers in this repo:
2116
2217
```bash
2318
minikube start --memory 4096
24-
# --vm-driver kvm
2519

2620
minikube dashboard
2721
# maybe wait a bit and retry
2822
kubectl get --all-namespaces services,pods
2923
```
3024

31-
## Extra configuration for Filebeat
25+
## Logging with Elasticsearch and fluentd
3226

3327
```bash
34-
minikube ssh
35-
36-
sudo sh -c "sed -i 's/^ExecStart=\/usr\/bin\/docker daemon.*$/& --log-opt labels=io.kubernetes.container.hash,io.kubernetes.container.name,io.kubernetes.pod.name,io.kubernetes.pod.namespace,io.kubernetes.pod.uid/' /etc/systemd/system/docker.service"
28+
kubectl apply \
29+
--filename https://raw.githubusercontent.com/giantswarm/kubernetes-elastic-stack/master/manifests-all.yaml
3730

38-
sudo systemctl daemon-reload
39-
sudo systemctl restart docker.service
31+
minikube service kibana
4032
```
4133

42-
## Logging with Elasticsearch and filebeat, fluentd or fluent-bit
34+
For the index pattern in Kibana choose `fluentd-*`, then switch to the "Discover" view.
35+
Every log line by containers running within the Kubernetes cluster is enhanced by meta data like `namespace_name`, `labels` and so on. This way it is easy to group and filter down on specific parts.
4336

44-
```bash
45-
kubectl apply \
46-
--filename https://raw.githubusercontent.com/giantswarm/kubernetes-elastic-stack/master/manifests-all.yaml
47-
minikube service --namespace logging kibana
48-
# for index pattern in Kibana choose `filebeat-*` and `@json.time` for Time-field name
49-
# or `fluentd-*`
50-
# or `fluent-bit-*`
51-
```
5237

5338
## Turn down all logging components
5439

5540
```bash
56-
kubectl delete namespace logging
41+
kubectl delete \
42+
--filename https://raw.githubusercontent.com/giantswarm/kubernetes-elastic-stack/master/manifests-all.yaml
5743
```
5844

45+
FIXME alternatively
46+
--selector stack=logging
47+
5948
To delete the whole local Kubernetes cluster use this:
6049

6150
```bash

docs/index.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
+++
22
title = "Logging with the Elastic Stack"
33
description = "The Elastic stack, also known as the ELK stack, has become a wide-spread tool for aggregating logs. This recipe helps you to set it up in Kubernetes."
4-
date = "2016-11-21"
4+
date = "2017-10-30"
55
type = "page"
66
weight = 50
77
tags = ["recipe"]
88
+++
99

1010
# Logging with the Elastic Stack
1111

12-
The Elastic stack, most prominently know as the ELK stack, in this recipe is the combination of Filebeat, Elasticsearch, and Kibana. This stack helps you get all logs from your containers into a single searchable data store without having to worry about logs disappearing together with the containers. With Kibana you get a nice analytics and visualization platform on top.
12+
The Elastic stack, most prominently know as the ELK stack, in this recipe is the combination of Fluentd, Elasticsearch, and Kibana. This stack helps you get all logs from your containers into a single searchable data store without having to worry about logs disappearing together with the containers. With Kibana you get a nice analytics and visualization platform on top.
1313

1414
![Kibana](kibana.png)
1515

@@ -27,22 +27,14 @@ kubectl apply \
2727
Now we need to open up Kibana. As we have no authentication set up in this recipe (you can check out [Shield](https://www.elastic.co/products/x-pack/security) for that), we access Kibana through
2828

2929
```nohighlight
30-
$ POD=$(kubectl get pods --namespace logging --selector component=kibana \
30+
$ POD=$(kubectl get pods --selector component=kibana \
3131
-o template --template '{{range .items}}{{.metadata.name}} {{.status.phase}}{{"\n"}}{{end}}' \
3232
| grep Running | head -1 | cut -f1 -d' ')
3333
$ kubectl port-forward --namespace logging $POD 5601:5601
3434
```
3535

3636
Now you can open up your browser at `http://localhost:5601/app/kibana/` and access the Kibana frontend.
3737

38-
Now set `filebeat-*` for `index pattern`.
39-
40-
Then, we can choose `json.time` for `time-field name` below.
38+
Now set `fluentd-*` for `index pattern`.
4139

4240
All set! You can now use Kibana to access your logs including filtering logs based on pod names and namespaces.
43-
44-
## Configuring Curator to change log retention
45-
46-
Included in this recipe, there is a Scheduled Job running [Curator](https://github.com/elastic/curator) once a day to clean up your logs. The pod is set to run at 1 minute past midnight and delete indices that are older than 3 days.
47-
48-
You can change this by editing the ConfigMap named `curator-config`. The definition of the `action_file.yaml` is quite self-explaining for simple set ups. For more advanced configuration options, please consult the [Curator Documentation](https://www.elastic.co/guide/en/elasticsearch/client/curator/current/index.html).

0 commit comments

Comments
 (0)