Enum RetentionDays

java.lang.Object
java.lang.Enum<RetentionDays>
software.amazon.awscdk.services.logs.RetentionDays
All Implemented Interfaces:
Serializable, Comparable<RetentionDays>, java.lang.constant.Constable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:38.137Z") @Stability(Stable) public enum RetentionDays extends Enum<RetentionDays>
How long, in days, the log contents will be retained.

Example:

 import software.amazon.awscdk.services.logs.*;
 Role myLogsPublishingRole;
 Vpc vpc;
 // Exporting logs from a cluster
 DatabaseCluster cluster = DatabaseCluster.Builder.create(this, "Database")
         .engine(DatabaseClusterEngine.aurora(AuroraClusterEngineProps.builder()
                 .version(AuroraEngineVersion.VER_1_17_9)
                 .build()))
         .instanceProps(InstanceProps.builder()
                 .vpc(vpc)
                 .build())
         .cloudwatchLogsExports(List.of("error", "general", "slowquery", "audit")) // Export all available MySQL-based logs
         .cloudwatchLogsRetention(RetentionDays.THREE_MONTHS) // Optional - default is to never expire logs
         .cloudwatchLogsRetentionRole(myLogsPublishingRole)
         .build();
 // Exporting logs from an instance
 DatabaseInstance instance = DatabaseInstance.Builder.create(this, "Instance")
         .engine(DatabaseInstanceEngine.postgres(PostgresInstanceEngineProps.builder()
                 .version(PostgresEngineVersion.VER_12_3)
                 .build()))
         .vpc(vpc)
         .cloudwatchLogsExports(List.of("postgresql"))
         .build();
 
  • Enum Constant Details

    • ONE_DAY

      @Stability(Stable) public static final RetentionDays ONE_DAY
      1 day.
    • THREE_DAYS

      @Stability(Stable) public static final RetentionDays THREE_DAYS
      3 days.
    • FIVE_DAYS

      @Stability(Stable) public static final RetentionDays FIVE_DAYS
      5 days.
    • ONE_WEEK

      @Stability(Stable) public static final RetentionDays ONE_WEEK
      1 week.
    • TWO_WEEKS

      @Stability(Stable) public static final RetentionDays TWO_WEEKS
      2 weeks.
    • ONE_MONTH

      @Stability(Stable) public static final RetentionDays ONE_MONTH
      1 month.
    • TWO_MONTHS

      @Stability(Stable) public static final RetentionDays TWO_MONTHS
      2 months.
    • THREE_MONTHS

      @Stability(Stable) public static final RetentionDays THREE_MONTHS
      3 months.
    • FOUR_MONTHS

      @Stability(Stable) public static final RetentionDays FOUR_MONTHS
      4 months.
    • FIVE_MONTHS

      @Stability(Stable) public static final RetentionDays FIVE_MONTHS
      5 months.
    • SIX_MONTHS

      @Stability(Stable) public static final RetentionDays SIX_MONTHS
      6 months.
    • ONE_YEAR

      @Stability(Stable) public static final RetentionDays ONE_YEAR
      1 year.
    • THIRTEEN_MONTHS

      @Stability(Stable) public static final RetentionDays THIRTEEN_MONTHS
      13 months.
    • EIGHTEEN_MONTHS

      @Stability(Stable) public static final RetentionDays EIGHTEEN_MONTHS
      18 months.
    • TWO_YEARS

      @Stability(Stable) public static final RetentionDays TWO_YEARS
      2 years.
    • FIVE_YEARS

      @Stability(Stable) public static final RetentionDays FIVE_YEARS
      5 years.
    • SIX_YEARS

      @Stability(Stable) public static final RetentionDays SIX_YEARS
      6 years.
    • SEVEN_YEARS

      @Stability(Stable) public static final RetentionDays SEVEN_YEARS
      7 years.
    • EIGHT_YEARS

      @Stability(Stable) public static final RetentionDays EIGHT_YEARS
      8 years.
    • NINE_YEARS

      @Stability(Stable) public static final RetentionDays NINE_YEARS
      9 years.
    • TEN_YEARS

      @Stability(Stable) public static final RetentionDays TEN_YEARS
      10 years.
    • INFINITE

      @Stability(Stable) public static final RetentionDays INFINITE
      Retain logs forever.
  • Method Details

    • values

      public static RetentionDays[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static RetentionDays valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null