Billing Account Sink Args
How-to Guides
Note You must have the "Logs Configuration Writer" IAM role (
roles/logging.configWriter
) granted on the billing account to the credentials used with this provider. IAM roles granted on a billing account are separate from the typical IAM roles granted on a project.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumi.gcp.logging.BillingAccountSink;
import com.pulumi.gcp.logging.BillingAccountSinkArgs;
import com.pulumi.gcp.projects.IAMBinding;
import com.pulumi.gcp.projects.IAMBindingArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var log_bucket = new Bucket("log-bucket", BucketArgs.builder()
.location("US")
.build());
var my_sink = new BillingAccountSink("my-sink", BillingAccountSinkArgs.builder()
.description("some explanation on what this is")
.billingAccount("ABCDEF-012345-GHIJKL")
.destination(log_bucket.name().applyValue(name -> String.format("storage.googleapis.com/%s", name)))
.build());
var log_writer = new IAMBinding("log-writer", IAMBindingArgs.builder()
.project("your-project-id")
.role("roles/storage.objectCreator")
.members(my_sink.writerIdentity())
.build());
}
}
Import
Billing account logging sinks can be imported using this format:
$ pulumi import gcp:logging/billingAccountSink:BillingAccountSink my_sink billingAccounts/{{billing_account_id}}/sinks/{{sink_id}}
Constructors
Properties
Options that affect sinks exporting data to BigQuery. Structure documented below.
The billing account exported to the sink.
A description of this sink. The maximum length of the description is 8000 characters.
The destination of the sink (or, in other words, where logs are written to). Can be a Cloud Storage bucket, a PubSub topic, a BigQuery dataset or a Cloud Logging bucket. Examples:
Log entries that match any of the exclusion filters will not be exported. If a log entry is matched by both filter
and one of exclusions.filter
, it will not be exported. Can be repeated multiple times for multiple exclusions. Structure is documented below.
The filter to apply when exporting logs. Only log entries that match the filter are exported. See Advanced Log Filters for information on how to write a filter.