# Analyzing BigQuery costs by linking the logging export

Follow the below steps to create and integrate a logging sink with Economize, allowing you to analyze BigQuery costs within [Reports](https://docs.economize.cloud/product-features/reports).

<figure><img src="https://4121990823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fn3X3NsKiruYotJHSzbQX%2Fuploads%2F0yRNXDN76IyCODUenD0Y%2FScreenshot%202025-09-10%20at%207.54.03%E2%80%AFPM.png?alt=media&#x26;token=95d9d3b4-7fd2-49d7-8889-30f1dd59ed8a" alt=""><figcaption></figcaption></figure>

## Step 1: Create a Logging sink

1. Navigate to the [BigQuery console](https://console.cloud.google.com/bigquery) to create a new dataset named **logging\_export** in the same project where you created the billing export dataset during onboarding.

![](https://ik.imagekit.io/economize/docs/dashboard/bq-cost-breakdown/pasted_image_0_r-FVjuCSQ.png)

2. For this newly created dataset configure the permission as follows:

   * Select the three vertical dots next to the dataset name, then click **Share**.
   * On the **Share permissions** panel that appears on the right, click **+ ADD PRINCIPAL**.
   * In the **New principals** field, under **Add principals**, paste the value of the service account based on your selected access method during onboarding.
   * In the **Role** field, under **Assign roles**, search for and select **BigQuery Data Editor**.

   ![](https://ik.imagekit.io/economize/docs/dashboard/bq-cost-breakdown/pasted_image_0-4_PGsZHDXsa05.png?ik-sdk-version=javascript-1.4.3\&updatedAt=1647102434330)
3. Now go to the [Log router](https://console.cloud.google.com/logs/router) and select **Create Sink.**

![](https://ik.imagekit.io/economize/docs/dashboard/bq-cost-breakdown/pasted_image_0-1_G7zAB6fg_.png?ik-sdk-version=javascript-1.4.3\&updatedAt=1647102433383)

4. Provide a sink name and select the BigQuery dataset **logging\_export** that you created earlier as the destination.
5. Click on the **Use partitioned tables** checkbox in the form.

![](https://ik.imagekit.io/economize/docs/dashboard/bq-cost-breakdown/pasted_image_0-2_DNazA4a2Z.png?ik-sdk-version=javascript-1.4.3\&updatedAt=1647102433762)

6. Provide the below inclusion filter in Step 3 when asked to **Choose logs to include in sink**.

{% code title="Inclusion filter" overflow="wrap" fullWidth="false" %}

```
protoPayload.serviceName="bigquery.googleapis.com" AND protoPayload.methodName="jobservice.jobcompleted"
```

{% endcode %}

![](https://ik.imagekit.io/economize/docs/dashboard/bq-cost-breakdown/pasted_image_0-3_AmRGC_DCN.png?ik-sdk-version=javascript-1.4.3\&updatedAt=1647102433859)

7. Leave the exclusion filter empty and click on **Create Sink**.

## Step 2: Integrate Logging sink with Economize <a href="#integrating-logging-sink" id="integrating-logging-sink"></a>

1. Navigate to the [**Projects page**](https://www.economize.cloud/app/settings/projects) from the settings of the Economize console.

<figure><img src="https://4121990823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fn3X3NsKiruYotJHSzbQX%2Fuploads%2FwsHe8K4uxzG22TMDrlR0%2FScreenshot%202024-03-12%20at%2011.59.27%20AM.png?alt=media&#x26;token=73ed3bc7-f69d-405b-b1d6-45cca26ecb35" alt="" width="563"><figcaption></figcaption></figure>

2. Click on the pen icon for the project you wish to analyze the BigQuery costs.
3. Enter the **Dataset ID** of the BigQuery dataset you created in step 1 in the following text field.

<figure><img src="https://4121990823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fn3X3NsKiruYotJHSzbQX%2Fuploads%2FlTsUDPewwKTmJuHOkvdu%2FScreenshot%202024-03-12%20at%2012.02.24%20PM.png?alt=media&#x26;token=e4a21bf8-d249-4fa1-b387-d7f19e25bc3a" alt="" width="563"><figcaption></figcaption></figure>

4. Test your connection to the dataset by clicking on the test button.

![](https://ik.imagekit.io/economize/docs/dashboard/bq-cost-breakdown/Screenshot_2022-03-12_at_6.23.03_PM_DLdMrWAJG.png?ik-sdk-version=javascript-1.4.3\&updatedAt=1647103502565)

5. Click on the **Save Changes** button.

{% hint style="success" %}
**SUCCESS**

You can now navigate to the [Reports](https://www.economize.cloud/app/gcp/reports) within the Economize console and start analyzing the BigQuery costs.
{% endhint %}
