Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud Container Optimized OS host logs to stackdriver

TL;DR
What is the best practice to send container optimized os host logs (ssh and executed shell commands) to Stackdriver?

Background:
I'm using Googles Container Optimized OS which works great. It's super easy to send the container logs to Stackdriver, but how do I send host logs to Stackdriver?

It's for auditing purposes, I need to log all SSH connections (accepted or denied) and all commands executed via shell. Previously I would simply send the rsyslogd (auth,authpriv) to stackdriver via the stackdriver host logger package.

This is for Container Optimized OS VM:s running in a managed instance group (mig), not in Google Kubernetes Engine.

It might be super obvious, but I can't seem to find any documentation on it.

like image 344
Niklas B Avatar asked Jun 24 '18 21:06

Niklas B


People also ask

What is Stackdriver logging in GCP?

Stackdriver Logging allows you to store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform and Amazon Web Services. It includes storage for logs, a user interface called the Logs Viewer, and an API to manage logs programmatically.

How long is data stored in Stackdriver logging?

Stackdriver Logging allows you to retain the logs for 30 days, and gives you a one-click configuration tool to archive data for a longer period in Google Cloud Storage.


1 Answers

how do I send host logs to Stackdriver?

Here are some code where COS packaged a Stackdriver Logging agent. You can start it via sudo systemctl start stackdriver-logging.

like image 198
Xuewei Zhang Avatar answered Oct 19 '22 19:10

Xuewei Zhang