Open In App

How To View Request Logs On Google Cloud Platform ?

Last Updated : 19 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Google Cloud Platform Logs Explorer is a tool that enables users to retrieve view and analyze log data helping them troubleshoot problems and monitor their resources effectively. Logs are records of event ed through Google Cloud Console and log entries can be read through the Logging API or Google Cloud CLI. Users can control how log entries are routed and stored using Log Router. The Logs Explorer lets users find and view logs to troubleshoot problems and log data can be exported to other applications using Google Cloud Pub/Sub. GCP logging provides a centralized location for storing and analyzing log data and allows users to set up alerts and notifications based on specific log patterns and events.

Primary Components Google Cloud Platform

  • Logs Explorer: A feature within the Google Cloud console that allows users to retrieve and analyze log data.
  • Log Entries: Record of events that occur in the operation of a and managed by Cloud Logging.
  • Logging API: An interface that enables programmatic access to log data.
  • Cloud CLI: Command line interface for Google Cloud used to manage resources and services.

Step-by-Step Process To Create A Google Cloud Run Service

Step 1: Navigate to Google Cloud and log in with your registered ID.

Step 2: In Console Navigation to the menu section and click on Cloud Run.

Clicking Cloud Run in GCP Menu

Step 3: Create a Service in the project by clicking on “Create a Service”. The following screenshot illustrates it clearly.

Create a Service in the Project

Step 4: In the create service form enter the following details and click on Next to continue .

  • Service Name: My project cloud run-service
  • Deployment Platform: Cloud Run
  • Region: us-central1 (or region closest to your location)

Service Settings

Step 5 : In Configure the Service’s first revision page enter the following details and click on Next.

  • Select Deploy one revision from an existing container image.
  • Use us-docker.pkg.dev/cloudrun/container/hello as the container image.

Deploying One revision from Existing Container Image

Step 6: In Configure how this service is triggered form, select the Allow all traffic option and Allow unauthenticated invocations in the respective fields. Click on Create to deploy the image to Cloud Run and wait for the deployment to finish.

Configuring how the service to be triggered

Step 7: After some time, your deployment will be completed.

Deployment of the project

Step 8: To check the deployment status, copy the URL generated in the Cloud Run details page.

Coping the URL of the Cloud Run

Step 9: Open the URL in a new tab and you will see you have successfully deployed a container image to the Cloud Run.

Verification And Testing

  • Access Your Service: Use the service’s URL, provided during deployment, to access it in your browser.
  • Test Functionality: Execute thorough tests to ensure your service works as expected.

Example Scenarios Of Viewing Request Logs

Example – 1

For example If you want to view the logs related to virtual machines created on Google Cloud Compute Engine you can use Logs Explorer to the Logging API to filter and retrieve the specific log entries related to VM creation.

Example – 2

For example let say you have web application running on Google Cloud Compute Engine and you want to view logs related to HTTP request made to application. You can use Logs Explorer to filter and retrieve specific log entries related to HTTP request.

View The Request Logs.

GCP View Requests Logs – FAQ’s

How Long Are Log Entries Retained?

Google Cloud Platform allows you to configure the retention period for log entries in Cloud Logging. The retention period can be set between 1 day and 365 days for both the default and user-defined log buckets. Log entries are retained for 30 days as per the Cloud Logging retention policy after which they are scheduled for deletion.

Can I Export Log Data To Other Applications?

Yes log data can be exported to other application using Google Cloud Pub/Sub.

What Are The Different Ways To Access Cloud Logging?

Cloud Logging can be accessed from Google Cloud Console through the Logging API and via Google Cloud CLI.

Which Google Cloud Service Implement Platform Logs?

Not all Google Cloud service implement platform logs. Service specific documentation should be referred to for information on whether particular service enables platform logs.

How Can I Track And Monitor Access Attempts To My VM Instances?

By enabling and utilizing feature such as firewall rule logging and web server logging you can track and monitor access attempt to your VM instances through Cloud Logging.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads