# Exporting Logs to BigQuery, GCS, Pub/Sub through Stackdriver

DevFeed: [Exporting Logs to BigQuery, GCS, Pub/Sub through Stackdriver](<https://devfeed.tech/articles/exporting-logs-to-bigquery-gcs-pub-sub-through-stackdriver-48668.md>)

Original publisher: [Read original article](<https://istio.io/latest/blog/2018/export-logs-through-stackdriver/>)

Author: Nupur Garg and Douglas Reid

Published: 2018-07-09T00:00:00Z

Content type: tutorial

Language: en

Sources: [Istio](<https://devfeed.tech/sources/istio-blog.md>)

Topics: [istio](<https://devfeed.tech/topics/istio.md>), [Cloud Logging](<https://devfeed.tech/topics/cloud-logging.md>), [Cloud Monitoring](<https://devfeed.tech/topics/cloud-monitoring.md>), [BigQuery](<https://devfeed.tech/topics/bigquery.md>), [Google Cloud Platform (GCP)](<https://devfeed.tech/topics/google-cloud.md>), [observability](<https://devfeed.tech/topics/observability.md>), [Security Information and Event Management (SIEM)](<https://devfeed.tech/topics/siem-security.md>), [Kubernetes](<https://devfeed.tech/topics/kubernetes.md>)

Tags: [bigquery](<https://devfeed.tech/tags/bigquery.md>), [cloud-pub-sub](<https://devfeed.tech/tags/cloud-pub-sub.md>), [google-cloud](<https://devfeed.tech/tags/google-cloud.md>), [istio](<https://devfeed.tech/tags/istio.md>), [kubernetes](<https://devfeed.tech/tags/kubernetes.md>), [logs](<https://devfeed.tech/tags/logs.md>), [mesh](<https://devfeed.tech/tags/mesh.md>), [microservices](<https://devfeed.tech/tags/microservices.md>), [permissions](<https://devfeed.tech/tags/permissions.md>), [services](<https://devfeed.tech/tags/services.md>), [stackdriver](<https://devfeed.tech/tags/stackdriver.md>)

## AI overview

A tutorial showing how to route Istio access logs through Stackdriver and export them to BigQuery, Google Cloud Storage, or Cloud Pub/Sub for analysis. It uses the Bookinfo sample application and covers sink setup, permissions, and related configuration.

## Source excerpt

This post shows how to direct Istio logs to Stackdriver and export those logs to various configured sinks such as such as BigQuery, Google Cloud Storage or Cloud Pub/Sub. At the end of this post you can perform analytics on Istio data from your favorite places such as BigQuery, GCS or Cloud Pub/Sub. The Bookinfo sample application is used as the example application throughout this task. Before you begin Install Istio in your cluster and deploy an application. Configuring Istio to export logs Istio exports logs using the logentry template. This specifies all the variables that are available for analysis. It contains information like source service, destination service, auth metrics (coming..) among others. Following is a diagram of the pipeline: Exporting logs from Istio to Stackdriver for analysis Istio supports exporting logs to Stackdriver which can in turn be configured to export logs to your favorite sink like BigQuery, Pub/Sub or GCS. Please follow the steps below to set up your favorite sink for exporting logs first and then Stackdriver in Istio. Setting up various log sinks Common setup for all sinks: Enable Stackdriver Monitoring API for the project. Make sure principalEmail that would be setting up the sink has write access to the project and Logging Admin role permissions. Make sure the GOOGLE_APPLICATION_CREDENTIALS environment variable is set. Please follow instructions here to set it up. BigQuery Create a BigQuery dataset as a destination for the logs export. Record the ID of the dataset. It will be needed to configure the Stackdriver handler. It would be of the form bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET_ID] Give sink's writer identity: cloud-logs@system.gserviceaccount.com BigQuery Data Editor role in IAM. If using Google Kubernetes Engine, make sure bigquery Scope is enabled on the cluster. Google Cloud Storage (GCS) Create a GCS bucket where you would like logs to get exported in GCS. Recode the ID of the bucket. It will be