1. Packages
  2. Packages
  3. Chronosphere
  4. API Docs
  5. LogRetentionConfig
Viewing docs for Chronosphere v0.9.16
published on Friday, Jun 5, 2026 by Chronosphere
Viewing docs for Chronosphere v0.9.16
published on Friday, Jun 5, 2026 by Chronosphere

    A retention policy dictating how long logs matching a given filter are kept before being deleted.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Pulumi = Chronosphere.Pulumi;
    
    return await Deployment.RunAsync(() => 
    {
        var productionErrors = new Pulumi.LogRetentionConfig("productionErrors", new()
        {
            Filter = "severity = 'error' AND env = 'production'",
            Mode = "ENABLED",
            Name = "Production Error Logs Long-term Retention",
            RetentionDays = 365,
        });
    
    });
    
    package main
    
    import (
    	"github.com/chronosphereio/pulumi-chronosphere/sdk/go/chronosphere"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := chronosphere.NewLogRetentionConfig(ctx, "productionErrors", &chronosphere.LogRetentionConfigArgs{
    			Filter:        pulumi.String("severity = 'error' AND env = 'production'"),
    			Mode:          pulumi.String("ENABLED"),
    			Name:          pulumi.String("Production Error Logs Long-term Retention"),
    			RetentionDays: pulumi.Int(365),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.chronosphere.LogRetentionConfig;
    import com.pulumi.chronosphere.LogRetentionConfigArgs;
    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 productionErrors = new LogRetentionConfig("productionErrors", LogRetentionConfigArgs.builder()        
                .filter("severity = 'error' AND env = 'production'")
                .mode("ENABLED")
                .name("Production Error Logs Long-term Retention")
                .retentionDays(365)
                .build());
    
        }
    }
    
    import * as pulumi from "@pulumi/pulumi";
    import * as chronosphere from "@pulumi-chronosphere/pulumi-chronosphere";
    
    const productionErrors = new chronosphere.LogRetentionConfig("productionErrors", {
        filter: "severity = 'error' AND env = 'production'",
        mode: "ENABLED",
        name: "Production Error Logs Long-term Retention",
        retentionDays: 365,
    });
    
    import pulumi
    import pulumi_chronosphere as chronosphere
    
    production_errors = chronosphere.LogRetentionConfig("productionErrors",
        filter="severity = 'error' AND env = 'production'",
        mode="ENABLED",
        name="Production Error Logs Long-term Retention",
        retention_days=365)
    
    resources:
      productionErrors:
        type: chronosphere:LogRetentionConfig
        properties:
          filter: severity = 'error' AND env = 'production'
          mode: ENABLED
          name: Production Error Logs Long-term Retention
          retentionDays: 365
    

    Create LogRetentionConfig Resource

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

    Constructor syntax

    new LogRetentionConfig(name: string, args: LogRetentionConfigArgs, opts?: CustomResourceOptions);
    @overload
    def LogRetentionConfig(resource_name: str,
                           args: LogRetentionConfigArgs,
                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def LogRetentionConfig(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           filter: Optional[str] = None,
                           mode: Optional[str] = None,
                           name: Optional[str] = None,
                           retention_days: Optional[int] = None,
                           slug: Optional[str] = None)
    func NewLogRetentionConfig(ctx *Context, name string, args LogRetentionConfigArgs, opts ...ResourceOption) (*LogRetentionConfig, error)
    public LogRetentionConfig(string name, LogRetentionConfigArgs args, CustomResourceOptions? opts = null)
    public LogRetentionConfig(String name, LogRetentionConfigArgs args)
    public LogRetentionConfig(String name, LogRetentionConfigArgs args, CustomResourceOptions options)
    
    type: chronosphere:LogRetentionConfig
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "chronosphere_logretentionconfig" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args LogRetentionConfigArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args LogRetentionConfigArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args LogRetentionConfigArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LogRetentionConfigArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LogRetentionConfigArgs
    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 logRetentionConfigResource = new Pulumi.LogRetentionConfig("logRetentionConfigResource", new()
    {
        Filter = "string",
        Mode = "string",
        Name = "string",
        RetentionDays = 0,
        Slug = "string",
    });
    
    example, err := chronosphere.NewLogRetentionConfig(ctx, "logRetentionConfigResource", &chronosphere.LogRetentionConfigArgs{
    	Filter:        pulumi.String("string"),
    	Mode:          pulumi.String("string"),
    	Name:          pulumi.String("string"),
    	RetentionDays: pulumi.Int(0),
    	Slug:          pulumi.String("string"),
    })
    
    resource "chronosphere_logretentionconfig" "logRetentionConfigResource" {
      filter         = "string"
      mode           = "string"
      name           = "string"
      retention_days = 0
      slug           = "string"
    }
    
    var logRetentionConfigResource = new LogRetentionConfig("logRetentionConfigResource", LogRetentionConfigArgs.builder()
        .filter("string")
        .mode("string")
        .name("string")
        .retentionDays(0)
        .slug("string")
        .build());
    
    log_retention_config_resource = chronosphere.LogRetentionConfig("logRetentionConfigResource",
        filter="string",
        mode="string",
        name="string",
        retention_days=0,
        slug="string")
    
    const logRetentionConfigResource = new chronosphere.LogRetentionConfig("logRetentionConfigResource", {
        filter: "string",
        mode: "string",
        name: "string",
        retentionDays: 0,
        slug: "string",
    });
    
    type: chronosphere:LogRetentionConfig
    properties:
        filter: string
        mode: string
        name: string
        retentionDays: 0
        slug: string
    

    LogRetentionConfig 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 LogRetentionConfig resource accepts the following input properties:

    Filter string
    Log query filter. The retention policy applies only to logs that match.
    Mode string
    Mode that determines how matching logs are retained in long-term (Iceberg) storage.
    Name string
    Display name of the log retention config.
    RetentionDays int
    Number of days to retain matching logs in long-term (Iceberg) storage after they are exported. When multiple configs overlap, the longest retention wins.
    Slug string
    Stable identifier for the log retention config. Generated from name if omitted. Immutable after creation.
    Filter string
    Log query filter. The retention policy applies only to logs that match.
    Mode string
    Mode that determines how matching logs are retained in long-term (Iceberg) storage.
    Name string
    Display name of the log retention config.
    RetentionDays int
    Number of days to retain matching logs in long-term (Iceberg) storage after they are exported. When multiple configs overlap, the longest retention wins.
    Slug string
    Stable identifier for the log retention config. Generated from name if omitted. Immutable after creation.
    filter string
    Log query filter. The retention policy applies only to logs that match.
    mode string
    Mode that determines how matching logs are retained in long-term (Iceberg) storage.
    name string
    Display name of the log retention config.
    retention_days number
    Number of days to retain matching logs in long-term (Iceberg) storage after they are exported. When multiple configs overlap, the longest retention wins.
    slug string
    Stable identifier for the log retention config. Generated from name if omitted. Immutable after creation.
    filter String
    Log query filter. The retention policy applies only to logs that match.
    mode String
    Mode that determines how matching logs are retained in long-term (Iceberg) storage.
    name String
    Display name of the log retention config.
    retentionDays Integer
    Number of days to retain matching logs in long-term (Iceberg) storage after they are exported. When multiple configs overlap, the longest retention wins.
    slug String
    Stable identifier for the log retention config. Generated from name if omitted. Immutable after creation.
    filter string
    Log query filter. The retention policy applies only to logs that match.
    mode string
    Mode that determines how matching logs are retained in long-term (Iceberg) storage.
    name string
    Display name of the log retention config.
    retentionDays number
    Number of days to retain matching logs in long-term (Iceberg) storage after they are exported. When multiple configs overlap, the longest retention wins.
    slug string
    Stable identifier for the log retention config. Generated from name if omitted. Immutable after creation.
    filter str
    Log query filter. The retention policy applies only to logs that match.
    mode str
    Mode that determines how matching logs are retained in long-term (Iceberg) storage.
    name str
    Display name of the log retention config.
    retention_days int
    Number of days to retain matching logs in long-term (Iceberg) storage after they are exported. When multiple configs overlap, the longest retention wins.
    slug str
    Stable identifier for the log retention config. Generated from name if omitted. Immutable after creation.
    filter String
    Log query filter. The retention policy applies only to logs that match.
    mode String
    Mode that determines how matching logs are retained in long-term (Iceberg) storage.
    name String
    Display name of the log retention config.
    retentionDays Number
    Number of days to retain matching logs in long-term (Iceberg) storage after they are exported. When multiple configs overlap, the longest retention wins.
    slug String
    Stable identifier for the log retention config. Generated from name if omitted. Immutable after creation.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing LogRetentionConfig Resource

    Get an existing LogRetentionConfig 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?: LogRetentionConfigState, opts?: CustomResourceOptions): LogRetentionConfig
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            filter: Optional[str] = None,
            mode: Optional[str] = None,
            name: Optional[str] = None,
            retention_days: Optional[int] = None,
            slug: Optional[str] = None) -> LogRetentionConfig
    func GetLogRetentionConfig(ctx *Context, name string, id IDInput, state *LogRetentionConfigState, opts ...ResourceOption) (*LogRetentionConfig, error)
    public static LogRetentionConfig Get(string name, Input<string> id, LogRetentionConfigState? state, CustomResourceOptions? opts = null)
    public static LogRetentionConfig get(String name, Output<String> id, LogRetentionConfigState state, CustomResourceOptions options)
    resources:  _:    type: chronosphere:LogRetentionConfig    get:      id: ${id}
    import {
      to = chronosphere_logretentionconfig.example
      id = "${id}"
    }
    
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    Filter string
    Log query filter. The retention policy applies only to logs that match.
    Mode string
    Mode that determines how matching logs are retained in long-term (Iceberg) storage.
    Name string
    Display name of the log retention config.
    RetentionDays int
    Number of days to retain matching logs in long-term (Iceberg) storage after they are exported. When multiple configs overlap, the longest retention wins.
    Slug string
    Stable identifier for the log retention config. Generated from name if omitted. Immutable after creation.
    Filter string
    Log query filter. The retention policy applies only to logs that match.
    Mode string
    Mode that determines how matching logs are retained in long-term (Iceberg) storage.
    Name string
    Display name of the log retention config.
    RetentionDays int
    Number of days to retain matching logs in long-term (Iceberg) storage after they are exported. When multiple configs overlap, the longest retention wins.
    Slug string
    Stable identifier for the log retention config. Generated from name if omitted. Immutable after creation.
    filter string
    Log query filter. The retention policy applies only to logs that match.
    mode string
    Mode that determines how matching logs are retained in long-term (Iceberg) storage.
    name string
    Display name of the log retention config.
    retention_days number
    Number of days to retain matching logs in long-term (Iceberg) storage after they are exported. When multiple configs overlap, the longest retention wins.
    slug string
    Stable identifier for the log retention config. Generated from name if omitted. Immutable after creation.
    filter String
    Log query filter. The retention policy applies only to logs that match.
    mode String
    Mode that determines how matching logs are retained in long-term (Iceberg) storage.
    name String
    Display name of the log retention config.
    retentionDays Integer
    Number of days to retain matching logs in long-term (Iceberg) storage after they are exported. When multiple configs overlap, the longest retention wins.
    slug String
    Stable identifier for the log retention config. Generated from name if omitted. Immutable after creation.
    filter string
    Log query filter. The retention policy applies only to logs that match.
    mode string
    Mode that determines how matching logs are retained in long-term (Iceberg) storage.
    name string
    Display name of the log retention config.
    retentionDays number
    Number of days to retain matching logs in long-term (Iceberg) storage after they are exported. When multiple configs overlap, the longest retention wins.
    slug string
    Stable identifier for the log retention config. Generated from name if omitted. Immutable after creation.
    filter str
    Log query filter. The retention policy applies only to logs that match.
    mode str
    Mode that determines how matching logs are retained in long-term (Iceberg) storage.
    name str
    Display name of the log retention config.
    retention_days int
    Number of days to retain matching logs in long-term (Iceberg) storage after they are exported. When multiple configs overlap, the longest retention wins.
    slug str
    Stable identifier for the log retention config. Generated from name if omitted. Immutable after creation.
    filter String
    Log query filter. The retention policy applies only to logs that match.
    mode String
    Mode that determines how matching logs are retained in long-term (Iceberg) storage.
    name String
    Display name of the log retention config.
    retentionDays Number
    Number of days to retain matching logs in long-term (Iceberg) storage after they are exported. When multiple configs overlap, the longest retention wins.
    slug String
    Stable identifier for the log retention config. Generated from name if omitted. Immutable after creation.

    Package Details

    Repository
    chronosphere chronosphereio/pulumi-chronosphere
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the chronosphere Terraform Provider.
    Viewing docs for Chronosphere v0.9.16
    published on Friday, Jun 5, 2026 by Chronosphere

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial