Export logs to BigQuery

Google Apps Script is integrated with Stackdriver Logging and Error Reporting, you can learn more about this integration in the official Apps Script documentation:

Why should you use BigQuery in combination with Stackdriver Logging?

It is possible to export Stackdriver logs to BigQuery, which is useful to perform aggregations and analyze trends. You can also use BigQuery simply to store logs for extended periods (the free version of Stackdriver keeps logs for 7 days and the premium tier offers a maximum of 30-day retention). 
This tutorial details how to set up such exports, the result in BigQuery along with a few useful queries.