Exporting Cloud Billing Data to BigQuery for Reporting

PDE By islever Editorial Last updated

Planning for using a data warehouse. Optimizing resources.

Short answer

A Do daily exports of Cloud Logging data to BigQuery and create views filtering by project, log type, resource, and user.

Question

Your new customer has requested daily reports that show their net consumption of Google Cloud compute resources and who used the resources. You need to
quickly and efficiently generate these daily reports. What should you do?
  1. Do daily exports of Cloud Logging data to BigQuery. Create views filtering by project, log type, resource, and user. Correct Answer
  2. Filter data in Cloud Logging by project, resource, and user; then export the data in CSV format.
  3. Filter data in Cloud Logging by project, log type, resource, and user, then import the data into BigQuery.
  4. Export Cloud Logging data to Cloud Storage in CSV format. Cleanse the data using Dataprep, filtering by project, resource, and user.

Key Takeaways

The trap is confusing general Cloud Logging with Billing data; while both can go to BigQuery, billing consumption reports require the specific Billing-to-BigQuery export sink, not generic log ingestion.

Generate daily compute consumption reports by exporting billing data to BigQuery and creating filtered views, as manual imports or CSV exports are unsupported or inefficient.

Common mistake: Option C is often chosen because it sounds like 'filtering before import,' but billing data has a fixed schema that cannot be imported manually via custom filters; it must be exported via the dedicated sink.

Expert Analysis

The scenario requires reporting on compute resource consumption and user attribution. This is a billing and cost management question, not a generic log analysis question. Google Cloud provides native integration between Cloud Billing and BigQuery to export billing data for granular analysis.

Option A is correct because it leverages the standard mechanism for exporting billing data: daily exports to BigQuery. The option mentions filtering by 'log type,' which in this context refers to the billing line item types or categories that distinguish compute usage from other costs (like storage or network). Creating views allows for efficient, reusable filtering by project, resource, and user without re-processing raw data every time.

The confusion arises from Option C, which suggests importing filtered data. However, you cannot manually import custom billing criteria into BigQuery; the schema is fixed by Google. You must use the automated export sinks provided by the platform. Options B and D involve manual CSV handling or Dataprep, which are inefficient and do not support the structured, automated daily reporting required. As noted by community members, exporting to JSON/CSV for billing is obsolete compared to using BigQuery directly. Therefore, the native BigQuery export with view-based filtering is the only scalable and supported method.

Official Reference

https://cloud.google.com/billing/docs/how-to/export-data-bigquery

This link opens the official vendor documentation in a new tab.

Exam Strategy

When asked about 'resource consumption' or 'costs,' look for BigQuery integration first. Avoid options suggesting manual CSV uploads or generic log filtering unless the question explicitly excludes billing services. Remember that billing exports have a fixed schema; you analyze them with SQL views, you don't reshape them during import.

Frequently Asked Questions

Why is Option C incorrect if I can filter logs before export?

While you can filter logs, billing data exports have a fixed schema defined by Google. You cannot manually import custom billing criteria or reshape the data structure upon import. You must use the automated sink and then filter using BigQuery views.

Is Cloud Logging the same as Cloud Billing for this question?

No. Cloud Logging tracks API calls and system events. Cloud Billing tracks financial consumption of resources. To report on 'net consumption' (cost/usage), you must use the Billing data export, not generic logging.

More PDE FAQ →

Community Votes

A
75%
D
17%
C
8%

75% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.

Discussion 30 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 30

  1. AWSandeep 👍 8
    A. Do daily exports of Cloud Logging data to BigQuery. Create views filtering by project, log type, resource, and user. You cannot import custom or filtered billing criteria into BigQuery. There are three types of Cloud Billing data tables with a fixed schema that must further drilled-down via BigQuery views. Reference: https://cloud.google.com/billing/docs/how-to/export-data-bigquery#setup
  2. devaid 👍 5
    2nd tought: Definitely A. If you go to google documentation for export billing, you see a message that "Exporting to JSON or CSV is obsolet. Use Big Query instead". Also why A? Look https://cloud.google.com/billing/docs/how-to/export-data-bigquery https://cloud.google.com/billing/docs/how-to/bq-examples#total-costs-on-invoice You can make a fast report template al Data Studio that read a Big Query view.
  3. maci_f 👍 4 Answered A
    B and D do not consider the log type field. C looks good and I would go for it. However, A looks equally good and I've found a CloudSkillsBoost lab that is exactly describing what answer A does, i.e. exporting logs to BQ and then creating a VIEW. https://www.cloudskillsboost.google/focuses/6100?parent=catalog I think the advantage of exporting complete logs (i.e. filtering them after they reach BQ) is that in case we would want to adjust the reporting in the future, we would have the complete logs with all fields available, whereas with C we would need to take extra steps.
  4. TNT87 👍 4
    Ans is C https://cloud.google.com/logging/docs/export/aggregated_sinks D isn't correct because Cloud storage is used as a sink when logs are in json format not csv. https://cloud.google.com/logging/docs/export/aggregated_sinks#supported-destinations
  5. Siant_137 👍 3 Answered C
    I see A as quite inefficient as you are exporting ALL logs (hundreds of thousands) to bq and the filtering them with views. I would go for C, assuming that it does not involve doing it manually but rather creating a SINK with the correct filters and then using BQ Dataset as sink destination. But a lot of assumptions are taking place here as I believe the questions does not provide much context.
Show 25 more comments
  1. devaid 👍 3 Answered A
    A. The D isn't filtering by log type. B and C are discarded because you need to drill down the exported loggs in Big Query or other.
  2. vaga1 👍 3 Answered A
    B, C, D do no generate a daily scalable solution.
  3. midgoo 👍 2 Answered A
    I almost got it wrong by choosing C. By doing C, that means we will manually filter first one by one. We should just import them all and filter using BigQuery
  4. changsu 👍 2 Answered D
    Quickly and efficiently! It's a flag to guide to DataPrep. And importing data to Bigquery does not mean a report.
  5. ducc 👍 2 Answered A
    A seem good for me
  6. MaxNRG 👍 1
    Here's why this option is the most effective: Integration with BigQuery: BigQuery is a powerful tool for analyzing large datasets. By exporting Cloud Logging data directly to BigQuery, you can leverage its fast querying capabilities and advanced analysis features. Automated Daily Exports: Setting up automated daily exports to BigQuery streamlines the reporting process, ensuring that data is consistently and efficiently transferred. Creating Views for Specific Filters: By creating views in BigQuery that filter data by project, log type, resource, and user, you can tailor the reports to the specific needs of your customer. Views also simplify repeated analysis by encapsulating complex SQL queries. Efficiency and Scalability: This method is highly efficient and scalable, handling large volumes of data without the manual intervention required for CSV exports and data cleansing.
  7. carbonscave 👍 1 Answered A
    Why A is correct The Power of BigQuery Log Sinks: The most efficient, native way to analyze Google Cloud audit logs (which track "who did what, where, and when") is to configure a Cloud Logging Sink to route logs directly into BigQuery. BigQuery automatically parses the complex JSON payloads of the logs into queryable columns. Automated Daily Reporting via Views: The prompt requires generating these reports daily. By creating BigQuery Views (saved SQL queries) that filter the dataset by project, resource, and user, you have effectively created an automated reporting pipeline. The customer can simply query the View or connect a dashboard (like Looker Studio) to it, and the daily report is instantly available with zero manual daily effort.
  8. AHUI 👍 1 Answered D
    The Google Cloud Storage bucket where you would like your reports to be delivered. You can select any Cloud Storage bucket for which you are an owner, including buckets that are from different projects. This bucket must exist before you can start exporting reports and you must have owner access to the bucket. Google Cloud Storage charges for usage, so you should review the Cloud Storage pricesheet for information on how you might incur charges for the service. https://cloud.google.com/compute/docs/logging/usage-export
  9. NicolasN 👍 1
    A comment regarding the links you provided (and not the correctness of the selected answer). Using Cloud Billing is something different than detecting compute consumption data from Cloud Logging. In fact, manual exporting to CSV (and JSON) is possible through the Logs Explorer interface (I think without user data break-down): 🔗 https://cloud.google.com/logging/docs/view/logs-explorer-interface#download_logs
  10. MaxNRG 👍 1
    Option B (exporting data in CSV format) and Option D (using Cloud Storage and Dataprep) are less efficient due to the additional steps and manual handling involved. Option C is similar to A but lacks the specificity of creating views directly in BigQuery for filtering, which is a more streamlined approach.
  11. MaxNRG 👍 1 Answered A
    For generating daily reports that show net consumption of Google Cloud compute resources and user details, the most efficient approach would be: A. Do daily exports of Cloud Logging data to BigQuery. Create views filtering by project, log type, resource, and user.
  12. Atnafu 👍 1
    You need to quickly and efficiently generate these daily reports by using Materialized view /View A materialized view is the best solution and having filtered value with a view is good solution so A is an answer
  13. Remi2021 👍 1
    Challenging. B is right one but with B you do not automate wich makes it hard, with A you ensure automation but there is no SQL support being mentioned which also makes me think that A is not the best choice.
  14. 22c1725 👍 1 Answered A
    Sadly, it's unclear what: "Do daily exports of Cloud Logging data to BigQuery" Does that means creating job? or you would be creating a sink into destination?
  15. jkhong 👍 1
    The question explicitly mentions daily generation of data so this would highlight, B and C seems that it is only suggesting a one-off filtering
  16. Aman47 👍 1
    You can choose a sink in which you want Cloud logging to continously send Logging data. You can choose which columns you want to see (filter).
  17. Atnafu 👍 1
    A Bad exporting data in csv or json due lack of some data so export is best practice 1:10 https://www.youtube.com/watch?v=ZyMO9XabUUM
  18. TNT87 👍 1
    On the other hand Ans A makes sense https://cloud.google.com/logging/docs/export/bigquery#overview
  19. John_Pongthorn 👍 1
    B is possible? https://cloud.google.com/logging/docs/view/logs-explorer-interface?cloudshell=true
  20. hauhau 👍 1 Answered A
    A because you filter data daily by view not just once by cloud logging
  21. TNT87 👍 1
    so wjhaytsa your argument about daily generartion of data??
  22. John_Pongthorn 👍 1
    Is it Possible to B ? This is the Easy way
  23. Wasss123 👍 1
    why not D ?
  24. pluiedust 👍 1
    Why not C?
  25. Aman47 👍 1
    Option C

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

← Back to PDE Study Guide