Show / Hide Table of Contents

Namespace Pulumi.Gcp.Logging

Classes

BillingAccountBucketConfig

Manages a billing account level logging bucket config. For more information see the official logging documentation and Storing Logs.

Note: Logging buckets are automatically created for a given folder, project, organization, billingAccount and cannot be deleted. Creating a resource of this type will acquire and update the resource that already exists at the desired location. These buckets cannot be removed so deleting this resource will remove the bucket config from your state but will leave the logging bucket unchanged. The buckets that are currently automatically created are "_Default" and "_Required".

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var @default = Output.Create(Gcp.Organizations.GetBillingAccount.InvokeAsync(new Gcp.Organizations.GetBillingAccountArgs
    {
        BillingAccount = "00AA00-000AAA-00AA0A",
    }));
    var basic = new Gcp.Logging.BillingAccountBucketConfig("basic", new Gcp.Logging.BillingAccountBucketConfigArgs
    {
        BillingAccount = @default.Apply(@default => @default.BillingAccount),
        Location = "global",
        RetentionDays = 30,
        BucketId = "_Default",
    });
}

}

BillingAccountBucketConfigArgs

BillingAccountBucketConfigState

BillingAccountExclusion

Manages a billing account logging exclusion. For more information see the official documentation and Excluding Logs.

Note that you must have the "Logs Configuration Writer" IAM role (roles/logging.configWriter) granted to the credentials used with the provider.

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var my_exclusion = new Gcp.Logging.BillingAccountExclusion("my-exclusion", new Gcp.Logging.BillingAccountExclusionArgs
    {
        BillingAccount = "ABCDEF-012345-GHIJKL",
        Description = "Exclude GCE instance debug logs",
        Filter = "resource.type = gce_instance AND severity <= DEBUG",
    });
}

}

BillingAccountExclusionArgs

BillingAccountExclusionState

BillingAccountSink

Manages a billing account logging sink. For more information see the official documentation and Exporting Logs in the API.

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

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var log_bucket = new Gcp.Storage.Bucket("log-bucket", new Gcp.Storage.BucketArgs
    {
    });
    var my_sink = new Gcp.Logging.BillingAccountSink("my-sink", new Gcp.Logging.BillingAccountSinkArgs
    {
        BillingAccount = "ABCDEF-012345-GHIJKL",
        Destination = log_bucket.Name.Apply(name => $"storage.googleapis.com/{name}"),
    });
    var log_writer = new Gcp.Projects.IAMBinding("log-writer", new Gcp.Projects.IAMBindingArgs
    {
        Role = "roles/storage.objectCreator",
        Members = 
        {
            my_sink.WriterIdentity,
        },
    });
}

}

BillingAccountSinkArgs

BillingAccountSinkState

FolderBucketConfig

Manages a folder-level logging bucket config. For more information see the official logging documentation and Storing Logs.

Note: Logging buckets are automatically created for a given folder, project, organization, billingAccount and cannot be deleted. Creating a resource of this type will acquire and update the resource that already exists at the desired location. These buckets cannot be removed so deleting this resource will remove the bucket config from your state but will leave the logging bucket unchanged. The buckets that are currently automatically created are "_Default" and "_Required".

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var @default = new Gcp.Organizations.Folder("default", new Gcp.Organizations.FolderArgs
    {
        DisplayName = "some-folder-name",
        Parent = "organizations/123456789",
    });
    var basic = new Gcp.Logging.FolderBucketConfig("basic", new Gcp.Logging.FolderBucketConfigArgs
    {
        Folder = @default.Name,
        Location = "global",
        RetentionDays = 30,
        BucketId = "_Default",
    });
}

}

FolderBucketConfigArgs

FolderBucketConfigState

FolderExclusion

Manages a folder-level logging exclusion. For more information see the official documentation and Excluding Logs.

Note that you must have the "Logs Configuration Writer" IAM role (roles/logging.configWriter) granted to the credentials used with this provider.

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var my_folder = new Gcp.Organizations.Folder("my-folder", new Gcp.Organizations.FolderArgs
    {
        DisplayName = "My folder",
        Parent = "organizations/123456",
    });
    var my_exclusion = new Gcp.Logging.FolderExclusion("my-exclusion", new Gcp.Logging.FolderExclusionArgs
    {
        Folder = my_folder.Name,
        Description = "Exclude GCE instance debug logs",
        Filter = "resource.type = gce_instance AND severity <= DEBUG",
    });
}

}

FolderExclusionArgs

FolderExclusionState

FolderSink

Manages a folder-level logging sink. For more information see the official documentation and Exporting Logs in the API.

Note that you must have the "Logs Configuration Writer" IAM role (roles/logging.configWriter) granted to the credentials used with this provider.

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var log_bucket = new Gcp.Storage.Bucket("log-bucket", new Gcp.Storage.BucketArgs
    {
    });
    var my_folder = new Gcp.Organizations.Folder("my-folder", new Gcp.Organizations.FolderArgs
    {
        DisplayName = "My folder",
        Parent = "organizations/123456",
    });
    var my_sink = new Gcp.Logging.FolderSink("my-sink", new Gcp.Logging.FolderSinkArgs
    {
        Folder = my_folder.Name,
        Destination = log_bucket.Name.Apply(name => $"storage.googleapis.com/{name}"),
        Filter = "resource.type = gce_instance AND severity >= WARN",
    });
    var log_writer = new Gcp.Projects.IAMBinding("log-writer", new Gcp.Projects.IAMBindingArgs
    {
        Role = "roles/storage.objectCreator",
        Members = 
        {
            my_sink.WriterIdentity,
        },
    });
}

}

FolderSinkArgs

FolderSinkState

Metric

Logs-based metric can also be used to extract values from logs and create a a distribution of the values. The distribution records the statistics of the extracted values along with an optional histogram of the values as specified by the bucket options.

To get more information about Metric, see:

  • API documentation
  • How-to Guides
  • Official Documentation

Example Usage - Logging Metric Basic

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var loggingMetric = new Gcp.Logging.Metric("loggingMetric", new Gcp.Logging.MetricArgs
    {
        BucketOptions = new Gcp.Logging.Inputs.MetricBucketOptionsArgs
        {
            LinearBuckets = new Gcp.Logging.Inputs.MetricBucketOptionsLinearBucketsArgs
            {
                NumFiniteBuckets = 3,
                Offset = 1,
                Width = 1,
            },
        },
        Filter = "resource.type=gae_app AND severity>=ERROR",
        LabelExtractors = 
        {
            { "mass", "EXTRACT(jsonPayload.request)" },
            { "sku", "EXTRACT(jsonPayload.id)" },
        },
        MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
        {
            DisplayName = "My metric",
            Labels = 
            {
                new Gcp.Logging.Inputs.MetricMetricDescriptorLabelArgs
                {
                    Description = "amount of matter",
                    Key = "mass",
                    ValueType = "STRING",
                },
                new Gcp.Logging.Inputs.MetricMetricDescriptorLabelArgs
                {
                    Description = "Identifying number for item",
                    Key = "sku",
                    ValueType = "INT64",
                },
            },
            MetricKind = "DELTA",
            Unit = "1",
            ValueType = "DISTRIBUTION",
        },
        ValueExtractor = "EXTRACT(jsonPayload.request)",
    });
}

}

Example Usage - Logging Metric Counter Basic

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var loggingMetric = new Gcp.Logging.Metric("loggingMetric", new Gcp.Logging.MetricArgs
    {
        Filter = "resource.type=gae_app AND severity>=ERROR",
        MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
        {
            MetricKind = "DELTA",
            ValueType = "INT64",
        },
    });
}

}

Example Usage - Logging Metric Counter Labels

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var loggingMetric = new Gcp.Logging.Metric("loggingMetric", new Gcp.Logging.MetricArgs
    {
        Filter = "resource.type=gae_app AND severity>=ERROR",
        LabelExtractors = 
        {
            { "mass", "EXTRACT(jsonPayload.request)" },
        },
        MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
        {
            Labels = 
            {
                new Gcp.Logging.Inputs.MetricMetricDescriptorLabelArgs
                {
                    Description = "amount of matter",
                    Key = "mass",
                    ValueType = "STRING",
                },
            },
            MetricKind = "DELTA",
            ValueType = "INT64",
        },
    });
}

}

MetricArgs

MetricState

OrganizationBucketConfig

Manages a organization-level logging bucket config. For more information see the official logging documentation and Storing Logs.

Note: Logging buckets are automatically created for a given folder, project, organization, billingAccount and cannot be deleted. Creating a resource of this type will acquire and update the resource that already exists at the desired location. These buckets cannot be removed so deleting this resource will remove the bucket config from your state but will leave the logging bucket unchanged. The buckets that are currently automatically created are "_Default" and "_Required".

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var @default = Output.Create(Gcp.Organizations.GetOrganization.InvokeAsync(new Gcp.Organizations.GetOrganizationArgs
    {
        Organization = "123456789",
    }));
    var basic = new Gcp.Logging.OrganizationBucketConfig("basic", new Gcp.Logging.OrganizationBucketConfigArgs
    {
        Organization = @default.Apply(@default => @default.Organization),
        Location = "global",
        RetentionDays = 30,
        BucketId = "_Default",
    });
}

}

OrganizationBucketConfigArgs

OrganizationBucketConfigState

OrganizationExclusion

Manages an organization-level logging exclusion. For more information see the official documentation and Excluding Logs.

Note that you must have the "Logs Configuration Writer" IAM role (roles/logging.configWriter) granted to the credentials used with this provider.

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var my_exclusion = new Gcp.Logging.OrganizationExclusion("my-exclusion", new Gcp.Logging.OrganizationExclusionArgs
    {
        Description = "Exclude GCE instance debug logs",
        Filter = "resource.type = gce_instance AND severity <= DEBUG",
        OrgId = "123456789",
    });
}

}

OrganizationExclusionArgs

OrganizationExclusionState

OrganizationSink

Manages a organization-level logging sink. For more information see the official documentation and Exporting Logs in the API.

Note that you must have the "Logs Configuration Writer" IAM role (roles/logging.configWriter) granted to the credentials used with this provider.

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var log_bucket = new Gcp.Storage.Bucket("log-bucket", new Gcp.Storage.BucketArgs
    {
    });
    var my_sink = new Gcp.Logging.OrganizationSink("my-sink", new Gcp.Logging.OrganizationSinkArgs
    {
        OrgId = "123456789",
        Destination = log_bucket.Name.Apply(name => $"storage.googleapis.com/{name}"),
        Filter = "resource.type = gce_instance AND severity >= WARN",
    });
    var log_writer = new Gcp.Projects.IAMMember("log-writer", new Gcp.Projects.IAMMemberArgs
    {
        Role = "roles/storage.objectCreator",
        Member = my_sink.WriterIdentity,
    });
}

}

OrganizationSinkArgs

OrganizationSinkState

ProjectBucketConfig

Manages a project-level logging bucket config. For more information see the official logging documentation and Storing Logs.

Note: Logging buckets are automatically created for a given folder, project, organization, billingAccount and cannot be deleted. Creating a resource of this type will acquire and update the resource that already exists at the desired location. These buckets cannot be removed so deleting this resource will remove the bucket config from your state but will leave the logging bucket unchanged. The buckets that are currently automatically created are "_Default" and "_Required".

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var @default = new Gcp.Organizations.Project("default", new Gcp.Organizations.ProjectArgs
    {
        ProjectId = "your-project-id",
        OrgId = "123456789",
    });
    var basic = new Gcp.Logging.ProjectBucketConfig("basic", new Gcp.Logging.ProjectBucketConfigArgs
    {
        Project = @default.Name,
        Location = "global",
        RetentionDays = 30,
        BucketId = "_Default",
    });
}

}

ProjectBucketConfigArgs

ProjectBucketConfigState

ProjectExclusion

Manages a project-level logging exclusion. For more information see the official documentation and Excluding Logs.

Note that you must have the "Logs Configuration Writer" IAM role (roles/logging.configWriter) granted to the credentials used with this provider.

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var my_exclusion = new Gcp.Logging.ProjectExclusion("my-exclusion", new Gcp.Logging.ProjectExclusionArgs
    {
        Description = "Exclude GCE instance debug logs",
        Filter = "resource.type = gce_instance AND severity <= DEBUG",
    });
}

}

ProjectExclusionArgs

ProjectExclusionState

ProjectSink

Manages a project-level logging sink. For more information see the official documentation, Exporting Logs in the API and API.

Note: You must have granted the "Logs Configuration Writer" IAM role (roles/logging.configWriter) to the credentials used with this provider.

Note You must enable the Cloud Resource Manager API

ProjectSinkArgs

ProjectSinkState

Back to top Copyright 2016-2020, Pulumi Corporation.