FolderSinkArgs

data class FolderSinkArgs(val bigqueryOptions: Output<FolderSinkBigqueryOptionsArgs>? = null, val description: Output<String>? = null, val destination: Output<String>? = null, val disabled: Output<Boolean>? = null, val exclusions: Output<List<FolderSinkExclusionArgs>>? = null, val filter: Output<String>? = null, val folder: Output<String>? = null, val includeChildren: Output<Boolean>? = null, val interceptChildren: Output<Boolean>? = null, val name: Output<String>? = null) : ConvertibleToJava<FolderSinkArgs>

Manages a folder-level logging sink. For more information see:

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const log_bucket = new gcp.storage.Bucket("log-bucket", {
name: "folder-logging-bucket",
location: "US",
});
const my_folder = new gcp.organizations.Folder("my-folder", {
displayName: "My folder",
parent: "organizations/123456",
});
const my_sink = new gcp.logging.FolderSink("my-sink", {
name: "my-sink",
description: "some explanation on what this is",
folder: my_folder.name,
destination: pulumi.interpolate`storage.googleapis.com/${log_bucket.name}`,
filter: "resource.type = gce_instance AND severity >= WARNING",
});
const log_writer = new gcp.projects.IAMBinding("log-writer", {
project: "your-project-id",
role: "roles/storage.objectCreator",
members: [my_sink&#46;writerIdentity],
});
import pulumi
import pulumi_gcp as gcp
log_bucket = gcp.storage.Bucket("log-bucket",
name="folder-logging-bucket",
location="US")
my_folder = gcp.organizations.Folder("my-folder",
display_name="My folder",
parent="organizations/123456")
my_sink = gcp.logging.FolderSink("my-sink",
name="my-sink",
description="some explanation on what this is",
folder=my_folder.name,
destination=log_bucket.name.apply(lambda name: f"storage.googleapis.com/{name}"),
filter="resource.type = gce_instance AND severity >= WARNING")
log_writer = gcp.projects.IAMBinding("log-writer",
project="your-project-id",
role="roles/storage.objectCreator",
members=[my_sink&#46;writer_identity])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var log_bucket = new Gcp.Storage.Bucket("log-bucket", new()
{
Name = "folder-logging-bucket",
Location = "US",
});
var my_folder = new Gcp.Organizations.Folder("my-folder", new()
{
DisplayName = "My folder",
Parent = "organizations/123456",
});
var my_sink = new Gcp.Logging.FolderSink("my-sink", new()
{
Name = "my-sink",
Description = "some explanation on what this is",
Folder = my_folder.Name,
Destination = log_bucket.Name.Apply(name => $"storage.googleapis.com/{name}"),
Filter = "resource.type = gce_instance AND severity >= WARNING",
});
var log_writer = new Gcp.Projects.IAMBinding("log-writer", new()
{
Project = "your-project-id",
Role = "roles/storage.objectCreator",
Members = new[]
{
my_sink.WriterIdentity,
},
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/logging"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := storage.NewBucket(ctx, "log-bucket", &storage.BucketArgs{
Name: pulumi.String("folder-logging-bucket"),
Location: pulumi.String("US"),
})
if err != nil {
return err
}
_, err = organizations.NewFolder(ctx, "my-folder", &organizations.FolderArgs{
DisplayName: pulumi.String("My folder"),
Parent: pulumi.String("organizations/123456"),
})
if err != nil {
return err
}
_, err = logging.NewFolderSink(ctx, "my-sink", &logging.FolderSinkArgs{
Name: pulumi.String("my-sink"),
Description: pulumi.String("some explanation on what this is"),
Folder: my_folder.Name,
Destination: log_bucket.Name.ApplyT(func(name string) (string, error) {
return fmt.Sprintf("storage.googleapis.com/%v", name), nil
}).(pulumi.StringOutput),
Filter: pulumi.String("resource.type = gce_instance AND severity >= WARNING"),
})
if err != nil {
return err
}
_, err = projects.NewIAMBinding(ctx, "log-writer", &projects.IAMBindingArgs{
Project: pulumi.String("your-project-id"),
Role: pulumi.String("roles/storage.objectCreator"),
Members: pulumi.StringArray{
my_sink.WriterIdentity,
},
})
if err != nil {
return err
}
return nil
})
}
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.organizations.Folder;
import com.pulumi.gcp.organizations.FolderArgs;
import com.pulumi.gcp.logging.FolderSink;
import com.pulumi.gcp.logging.FolderSinkArgs;
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()
.name("folder-logging-bucket")
.location("US")
.build());
var my_folder = new Folder("my-folder", FolderArgs.builder()
.displayName("My folder")
.parent("organizations/123456")
.build());
var my_sink = new FolderSink("my-sink", FolderSinkArgs.builder()
.name("my-sink")
.description("some explanation on what this is")
.folder(my_folder.name())
.destination(log_bucket.name().applyValue(name -> String.format("storage.googleapis.com/%s", name)))
.filter("resource.type = gce_instance AND severity >= WARNING")
.build());
var log_writer = new IAMBinding("log-writer", IAMBindingArgs.builder()
.project("your-project-id")
.role("roles/storage.objectCreator")
.members(my_sink.writerIdentity())
.build());
}
}
resources:
my-sink:
type: gcp:logging:FolderSink
properties:
name: my-sink
description: some explanation on what this is
folder: ${["my-folder"].name}
destination: storage.googleapis.com/${["log-bucket"].name}
filter: resource.type = gce_instance AND severity >= WARNING
log-bucket:
type: gcp:storage:Bucket
properties:
name: folder-logging-bucket
location: US
log-writer:
type: gcp:projects:IAMBinding
properties:
project: your-project-id
role: roles/storage.objectCreator
members:
- ${["my-sink"].writerIdentity}
my-folder:
type: gcp:organizations:Folder
properties:
displayName: My folder
parent: organizations/123456

Import

Folder-level logging sinks can be imported using this format:

  • folders/{{folder_id}}/sinks/{{name}} When using the pulumi import command, folder-level logging sinks can be imported using one of the formats above. For example:

$ pulumi import gcp:logging/folderSink:FolderSink default folders/{{folder_id}}/sinks/{{name}}

Constructors

Link copied to clipboard
constructor(bigqueryOptions: Output<FolderSinkBigqueryOptionsArgs>? = null, description: Output<String>? = null, destination: Output<String>? = null, disabled: Output<Boolean>? = null, exclusions: Output<List<FolderSinkExclusionArgs>>? = null, filter: Output<String>? = null, folder: Output<String>? = null, includeChildren: Output<Boolean>? = null, interceptChildren: Output<Boolean>? = null, name: Output<String>? = null)

Properties

Link copied to clipboard

Options that affect sinks exporting data to BigQuery. Structure documented below.

Link copied to clipboard
val description: Output<String>? = null

A description of this sink. The maximum length of the description is 8000 characters.

Link copied to clipboard
val destination: Output<String>? = null

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, a Cloud Logging bucket, or a Google Cloud project. Examples:

Link copied to clipboard
val disabled: Output<Boolean>? = null

If set to True, then this sink is disabled and it does not export any log entries.

Link copied to clipboard

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.

Link copied to clipboard
val filter: Output<String>? = null

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.

Link copied to clipboard
val folder: Output<String>? = null

The folder to be exported to the sink. Note that either [FOLDER_ID] or folders/[FOLDER_ID] is accepted.

Link copied to clipboard
val includeChildren: Output<Boolean>? = null

Whether or not to include children folders in the sink export. If true, logs associated with child projects are also exported; otherwise only logs relating to the provided folder are included.

Link copied to clipboard
val interceptChildren: Output<Boolean>? = null

Whether or not to intercept logs from child projects. If true, matching logs will not match with sinks in child resources, except _Required sinks. This sink will be visible to child resources when listing sinks.

Link copied to clipboard
val name: Output<String>? = null

The name of the logging sink.

Functions

Link copied to clipboard
open override fun toJava(): FolderSinkArgs