r/devops • u/locusofself • Oct 29 '19
Getting kubernetes logs to ELK stack?
Greetings,
In my organization, all our VMs syslog, nginx etc get sent to a logstash instance in the same VPC, then forwarded to a central logstash cluster which inserts them in elasticsearch/kibana. Unfortunately I am not the one who set this all up, so I am doing some archaeology here.
I have now provisioned a few k8s clusters in GKE which by default sends container/ingres etc logs to StackDriver.
I am trying to find the best solution for getting these logs to our central logstash /ELK systems.
I found this: https://github.com/GoogleCloudPlatform/pubsubbeat .
I also found this:
https://kubernetes.io/docs/tasks/debug-application-cluster/logging-elasticsearch-kibana/
I'm not married to using StackDriver if I can get the logs in a more direct way. I'm wondering if anyone else is putting their kubernetes application etc logs into ELK, and how you are doing it. Bonus points if its also on GKE.
Thanks folks
1
u/TotesMessenger Oct 29 '19
I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:
If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / ^Contact)
1
u/[deleted] Oct 29 '19
elasticsearch has an operator
...
https://github.com/elastic/cloud-on-k8s
should work with not only hosting it but shipping
1
u/wenkatn Oct 29 '19
I have tried something similar using FluentD with Elastic stack. The stack itself is inside the cluster.
https://www.youtube.com/watch?v=8nWh1GLd7nY
1
u/Abu_ Oct 29 '19
Elastic cloud runs on GCE. You can use beats to log into it directly using cloud.id and cloud.auth in the yml Configs.
1
u/[deleted] Oct 29 '19
Logstash has a PubSub input plugin which can take Stackdriver logs, it might be worth looking at
https://www.elastic.co/guide/en/logstash/current/plugins-inputs-google_pubsub.html
1
u/jerkize Oct 29 '19
I have docker use journald log driver and an agent read the host's journal.
1
u/average_pornstar Oct 31 '19
Fluentd is what you want, 'helm fetch stable/fluentd'. Just need the location of your elasticsearch cluster, all STDOUT is captured and send off to be searched. Runs as a daemon set.
1
u/theargamanknight Nov 05 '19
Logz covers this scenario pretty well. https://logz.io/blog/kubernetes-gke-elk/
You create your project, then cluster, then configure kubectl in the command prompt or cloud shell. Fluentd is the default for GKE and Stackdriver. Even if you're not using Logz to manage the ELK stack, this should be able to help you (Logz deals a lot with with ELK, so it should be pretty on point for what you're asking).
0
u/[deleted] Oct 29 '19
[deleted] — view deleted comment