1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Logging
  5. LogGroup
Oracle Cloud Infrastructure v2.29.0 published on Wednesday, Apr 9, 2025 by Pulumi

oci.Logging.LogGroup

Explore with Pulumi AI

This resource provides the Log Group resource in Oracle Cloud Infrastructure Logging service.

Create a new log group with a unique display name. This call fails if the log group is already created with the same displayName in the compartment.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";

const testLogGroup = new oci.logging.LogGroup("test_log_group", {
    compartmentId: compartmentId,
    displayName: logGroupDisplayName,
    definedTags: {
        "Operations.CostCenter": "42",
    },
    description: logGroupDescription,
    freeformTags: {
        Department: "Finance",
    },
});
Copy
import pulumi
import pulumi_oci as oci

test_log_group = oci.logging.LogGroup("test_log_group",
    compartment_id=compartment_id,
    display_name=log_group_display_name,
    defined_tags={
        "Operations.CostCenter": "42",
    },
    description=log_group_description,
    freeform_tags={
        "Department": "Finance",
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/logging"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := logging.NewLogGroup(ctx, "test_log_group", &logging.LogGroupArgs{
			CompartmentId: pulumi.Any(compartmentId),
			DisplayName:   pulumi.Any(logGroupDisplayName),
			DefinedTags: pulumi.StringMap{
				"Operations.CostCenter": pulumi.String("42"),
			},
			Description: pulumi.Any(logGroupDescription),
			FreeformTags: pulumi.StringMap{
				"Department": pulumi.String("Finance"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;

return await Deployment.RunAsync(() => 
{
    var testLogGroup = new Oci.Logging.LogGroup("test_log_group", new()
    {
        CompartmentId = compartmentId,
        DisplayName = logGroupDisplayName,
        DefinedTags = 
        {
            { "Operations.CostCenter", "42" },
        },
        Description = logGroupDescription,
        FreeformTags = 
        {
            { "Department", "Finance" },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.Logging.LogGroup;
import com.pulumi.oci.Logging.LogGroupArgs;
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 testLogGroup = new LogGroup("testLogGroup", LogGroupArgs.builder()
            .compartmentId(compartmentId)
            .displayName(logGroupDisplayName)
            .definedTags(Map.of("Operations.CostCenter", "42"))
            .description(logGroupDescription)
            .freeformTags(Map.of("Department", "Finance"))
            .build());

    }
}
Copy
resources:
  testLogGroup:
    type: oci:Logging:LogGroup
    name: test_log_group
    properties:
      compartmentId: ${compartmentId}
      displayName: ${logGroupDisplayName}
      definedTags:
        Operations.CostCenter: '42'
      description: ${logGroupDescription}
      freeformTags:
        Department: Finance
Copy

Create LogGroup Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new LogGroup(name: string, args: LogGroupArgs, opts?: CustomResourceOptions);
@overload
def LogGroup(resource_name: str,
             args: LogGroupArgs,
             opts: Optional[ResourceOptions] = None)

@overload
def LogGroup(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             compartment_id: Optional[str] = None,
             display_name: Optional[str] = None,
             defined_tags: Optional[Mapping[str, str]] = None,
             description: Optional[str] = None,
             freeform_tags: Optional[Mapping[str, str]] = None)
func NewLogGroup(ctx *Context, name string, args LogGroupArgs, opts ...ResourceOption) (*LogGroup, error)
public LogGroup(string name, LogGroupArgs args, CustomResourceOptions? opts = null)
public LogGroup(String name, LogGroupArgs args)
public LogGroup(String name, LogGroupArgs args, CustomResourceOptions options)
type: oci:Logging:LogGroup
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. LogGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. LogGroupArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. LogGroupArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. LogGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. LogGroupArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var logGroupResource = new Oci.Logging.LogGroup("logGroupResource", new()
{
    CompartmentId = "string",
    DisplayName = "string",
    DefinedTags = 
    {
        { "string", "string" },
    },
    Description = "string",
    FreeformTags = 
    {
        { "string", "string" },
    },
});
Copy
example, err := Logging.NewLogGroup(ctx, "logGroupResource", &Logging.LogGroupArgs{
	CompartmentId: pulumi.String("string"),
	DisplayName:   pulumi.String("string"),
	DefinedTags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Description: pulumi.String("string"),
	FreeformTags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
Copy
var logGroupResource = new LogGroup("logGroupResource", LogGroupArgs.builder()
    .compartmentId("string")
    .displayName("string")
    .definedTags(Map.of("string", "string"))
    .description("string")
    .freeformTags(Map.of("string", "string"))
    .build());
Copy
log_group_resource = oci.logging.LogGroup("logGroupResource",
    compartment_id="string",
    display_name="string",
    defined_tags={
        "string": "string",
    },
    description="string",
    freeform_tags={
        "string": "string",
    })
Copy
const logGroupResource = new oci.logging.LogGroup("logGroupResource", {
    compartmentId: "string",
    displayName: "string",
    definedTags: {
        string: "string",
    },
    description: "string",
    freeformTags: {
        string: "string",
    },
});
Copy
type: oci:Logging:LogGroup
properties:
    compartmentId: string
    definedTags:
        string: string
    description: string
    displayName: string
    freeformTags:
        string: string
Copy

LogGroup Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The LogGroup resource accepts the following input properties:

CompartmentId This property is required. string
(Updatable) The OCID of the compartment that the resource belongs to.
DisplayName This property is required. string
(Updatable) The user-friendly display name. This must be unique within the enclosing resource, and it's changeable. Avoid entering confidential information.
DefinedTags Dictionary<string, string>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
Description string
(Updatable) Description for this resource.
FreeformTags Dictionary<string, string>

(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

CompartmentId This property is required. string
(Updatable) The OCID of the compartment that the resource belongs to.
DisplayName This property is required. string
(Updatable) The user-friendly display name. This must be unique within the enclosing resource, and it's changeable. Avoid entering confidential information.
DefinedTags map[string]string
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
Description string
(Updatable) Description for this resource.
FreeformTags map[string]string

(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

compartmentId This property is required. String
(Updatable) The OCID of the compartment that the resource belongs to.
displayName This property is required. String
(Updatable) The user-friendly display name. This must be unique within the enclosing resource, and it's changeable. Avoid entering confidential information.
definedTags Map<String,String>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description String
(Updatable) Description for this resource.
freeformTags Map<String,String>

(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

compartmentId This property is required. string
(Updatable) The OCID of the compartment that the resource belongs to.
displayName This property is required. string
(Updatable) The user-friendly display name. This must be unique within the enclosing resource, and it's changeable. Avoid entering confidential information.
definedTags {[key: string]: string}
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description string
(Updatable) Description for this resource.
freeformTags {[key: string]: string}

(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

compartment_id This property is required. str
(Updatable) The OCID of the compartment that the resource belongs to.
display_name This property is required. str
(Updatable) The user-friendly display name. This must be unique within the enclosing resource, and it's changeable. Avoid entering confidential information.
defined_tags Mapping[str, str]
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description str
(Updatable) Description for this resource.
freeform_tags Mapping[str, str]

(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

compartmentId This property is required. String
(Updatable) The OCID of the compartment that the resource belongs to.
displayName This property is required. String
(Updatable) The user-friendly display name. This must be unique within the enclosing resource, and it's changeable. Avoid entering confidential information.
definedTags Map<String>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description String
(Updatable) Description for this resource.
freeformTags Map<String>

(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

Outputs

All input properties are implicitly available as output properties. Additionally, the LogGroup resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
State string
The log group object state.
TimeCreated string
Time the resource was created.
TimeLastModified string
Time the resource was last modified.
Id string
The provider-assigned unique ID for this managed resource.
State string
The log group object state.
TimeCreated string
Time the resource was created.
TimeLastModified string
Time the resource was last modified.
id String
The provider-assigned unique ID for this managed resource.
state String
The log group object state.
timeCreated String
Time the resource was created.
timeLastModified String
Time the resource was last modified.
id string
The provider-assigned unique ID for this managed resource.
state string
The log group object state.
timeCreated string
Time the resource was created.
timeLastModified string
Time the resource was last modified.
id str
The provider-assigned unique ID for this managed resource.
state str
The log group object state.
time_created str
Time the resource was created.
time_last_modified str
Time the resource was last modified.
id String
The provider-assigned unique ID for this managed resource.
state String
The log group object state.
timeCreated String
Time the resource was created.
timeLastModified String
Time the resource was last modified.

Look up Existing LogGroup Resource

Get an existing LogGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: LogGroupState, opts?: CustomResourceOptions): LogGroup
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        compartment_id: Optional[str] = None,
        defined_tags: Optional[Mapping[str, str]] = None,
        description: Optional[str] = None,
        display_name: Optional[str] = None,
        freeform_tags: Optional[Mapping[str, str]] = None,
        state: Optional[str] = None,
        time_created: Optional[str] = None,
        time_last_modified: Optional[str] = None) -> LogGroup
func GetLogGroup(ctx *Context, name string, id IDInput, state *LogGroupState, opts ...ResourceOption) (*LogGroup, error)
public static LogGroup Get(string name, Input<string> id, LogGroupState? state, CustomResourceOptions? opts = null)
public static LogGroup get(String name, Output<String> id, LogGroupState state, CustomResourceOptions options)
resources:  _:    type: oci:Logging:LogGroup    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
CompartmentId string
(Updatable) The OCID of the compartment that the resource belongs to.
DefinedTags Dictionary<string, string>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
Description string
(Updatable) Description for this resource.
DisplayName string
(Updatable) The user-friendly display name. This must be unique within the enclosing resource, and it's changeable. Avoid entering confidential information.
FreeformTags Dictionary<string, string>

(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

State string
The log group object state.
TimeCreated string
Time the resource was created.
TimeLastModified string
Time the resource was last modified.
CompartmentId string
(Updatable) The OCID of the compartment that the resource belongs to.
DefinedTags map[string]string
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
Description string
(Updatable) Description for this resource.
DisplayName string
(Updatable) The user-friendly display name. This must be unique within the enclosing resource, and it's changeable. Avoid entering confidential information.
FreeformTags map[string]string

(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

State string
The log group object state.
TimeCreated string
Time the resource was created.
TimeLastModified string
Time the resource was last modified.
compartmentId String
(Updatable) The OCID of the compartment that the resource belongs to.
definedTags Map<String,String>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description String
(Updatable) Description for this resource.
displayName String
(Updatable) The user-friendly display name. This must be unique within the enclosing resource, and it's changeable. Avoid entering confidential information.
freeformTags Map<String,String>

(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

state String
The log group object state.
timeCreated String
Time the resource was created.
timeLastModified String
Time the resource was last modified.
compartmentId string
(Updatable) The OCID of the compartment that the resource belongs to.
definedTags {[key: string]: string}
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description string
(Updatable) Description for this resource.
displayName string
(Updatable) The user-friendly display name. This must be unique within the enclosing resource, and it's changeable. Avoid entering confidential information.
freeformTags {[key: string]: string}

(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

state string
The log group object state.
timeCreated string
Time the resource was created.
timeLastModified string
Time the resource was last modified.
compartment_id str
(Updatable) The OCID of the compartment that the resource belongs to.
defined_tags Mapping[str, str]
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description str
(Updatable) Description for this resource.
display_name str
(Updatable) The user-friendly display name. This must be unique within the enclosing resource, and it's changeable. Avoid entering confidential information.
freeform_tags Mapping[str, str]

(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

state str
The log group object state.
time_created str
Time the resource was created.
time_last_modified str
Time the resource was last modified.
compartmentId String
(Updatable) The OCID of the compartment that the resource belongs to.
definedTags Map<String>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description String
(Updatable) Description for this resource.
displayName String
(Updatable) The user-friendly display name. This must be unique within the enclosing resource, and it's changeable. Avoid entering confidential information.
freeformTags Map<String>

(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

state String
The log group object state.
timeCreated String
Time the resource was created.
timeLastModified String
Time the resource was last modified.

Import

LogGroups can be imported using the id, e.g.

$ pulumi import oci:Logging/logGroup:LogGroup test_log_group "id"
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
oci pulumi/pulumi-oci
License
Apache-2.0
Notes
This Pulumi package is based on the oci Terraform Provider.