9

I have a running Kubernetes cluster that aggregates it's logfiles in stackdriver and would like to tail the aggregated logs on the command line. But so far I am only able to view the json stream float by in the web interface or fetch historic logging data with a command like gcloud beta logging read 'resource.type="container" jsonPayload.service:("my-service") timestamp >= "2017-06-22T16:00:00+02:00"' --format=json.

Is there no way in GCE for me to build an aggregated real time view of the current log entries, like you would get from a tail -f?

keyboardsamurai
  • 271
  • 2
  • 6
  • 1
    You can stream logs from the GCE VM instances by installing the stackdriver logging agent on the GCE VM instances. Google container engine does not require this agent. Instructions are available at this [link](https://cloud.google.com/logging/docs/agent/installation). Once installed, you will be able to stream the aggregated VM instances logs real-time similar to container engine logs you already been able to stream. Let me know if it helps, if not add more information for the use case. – N Singh Aug 23 '17 at 18:19

1 Answers1

2

The only realtime like thing that you could use is to create a sink from Stackdriver to Pub/Sub and create a consumer that will receive in almost real time, messages from SD; the other options are based on sending chunks of information every X time and won't be as near realtime as you would like.

You can read about exporting logs in Googles SD documentation for that matter.

I hope this information can help you solve your issue.

Regards! -JP

JorgeHPM
  • 41
  • 4
  • I wanted to downvote you... but then I've figured out it's not your fault, great answer but bad solution – confiq May 06 '20 at 08:51