-2

I am new to google cloud. I have a java application and I write logs in my compute engines storage itself. That is I have a log folder inside my e2-small machine and I have log files in that folder. I can ssh to my compute engine and view logs but want to explore how to use google cloud tools for same.

I have explored

  1. https://cloud.google.com/logging/docs/view/logs-viewer-interface
  2. https://cloud.google.com/appengine/docs/standard/nodejs/building-app/viewing-service-logs

and also few stackoverflow questions. Right now is view audit events for my compute engine like (Removing user viraj and Updating keys for user viraj)

Please let me know if any more information is required or if I am missing in my cloud setup?

Viraj Nalawade
  • 3,137
  • 3
  • 28
  • 44
  • I think you may want to take a look to the Cloud Logging [libs](https://cloud.google.com/logging/docs/setup/java) so your application can send logs directly to Logging and you can inspect everything there since the audit logs are more intended to operations done to the VM as product and not what is running there – Puteri Apr 24 '21 at 17:24
  • Sure @YeriPelona , will explore that, please share if any recommended links. Also is there no way I can ask Google cloud logging to pick my log files from compute engine directory? – Viraj Nalawade Apr 24 '21 at 17:40
  • Here's another approach you may want to check https://stackoverflow.com/questions/60692483/how-to-logging-python-script-log-into-google-stackdriver-logging-running-on-a-go – Puteri Apr 24 '21 at 18:12
  • 2
    Installing Cloud Logging on your VM. Then create a fluentd configuration file that forwards your custom log files to Cloud Logging. This answer will point you in the right direction: https://stackoverflow.com/a/60702108/8016720 – John Hanley Apr 24 '21 at 19:17
  • if you find my answer useful, please consider upvoting/accepting it, thank you! – Jaime López May 03 '21 at 16:56

1 Answers1

1

As mentioned by @YariPelona, there's a post with a similar question at the post: How to logging python script log into Google stackdriver logging running on a Google Cloud VM.

The tool that will help you is Cloud Logging, which will allow you to see your logs in a Log Explorer ans setup custom monitoring depending on your app/project needs by installing the Monitoring agent, which includes setup guides for such monitoring at several 3rd party apps.

Find the guide to install, configure and authorize the monitoring agent in This link:
Installing the agent on a single VM

Then you can go to this link to find out how to use Cloud Loggin and see your logg in the Log Explorer by enabling it on your VM instance or using Cloud Shell with gcloud commands:
Quickstart using Logging tools.

And last but not least, in the next link you will find the Guides to monitor third-party applications like Apache web server, MySql, Cassandra, Tomcat, etc (Plugin enablement), with the tools mentioned above:
Monitoring third-party applications

Jaime López
  • 448
  • 3
  • 11