Class: AWSCDK::ECS::AWSLogDriverProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ecs/aws_log_driver_props.rb

Overview

Specifies the awslogs log driver configuration options.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream_prefix:, datetime_format: nil, log_group: nil, log_retention: nil, max_buffer_size: nil, mode: nil, multiline_pattern: nil) ⇒ AWSLogDriverProps

Returns a new instance of AWSLogDriverProps.

Parameters:

  • stream_prefix (String)

    Prefix for the log streams.

  • datetime_format (String, nil) (defaults to: nil)

    This option defines a multiline start pattern in Python strftime format.

  • log_group (AWSCDK::Interfaces::AWSLogs::ILogGroupRef, nil) (defaults to: nil)

    The log group to log to.

  • log_retention (AWSCDK::Logs::RetentionDays, nil) (defaults to: nil)

    The number of days log events are kept in CloudWatch Logs when the log group is automatically created by this construct.

  • max_buffer_size (AWSCDK::Size, nil) (defaults to: nil)

    When AwsLogDriverMode.NON_BLOCKING is configured, this parameter controls the size of the non-blocking buffer used to temporarily store messages. This parameter is not valid with AwsLogDriverMode.BLOCKING.

  • mode (AWSCDK::ECS::AWSLogDriverMode, nil) (defaults to: nil)

    The delivery mode of log messages from the container to awslogs.

  • multiline_pattern (String, nil) (defaults to: nil)

    This option defines a multiline start pattern using a regular expression.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'ecs/aws_log_driver_props.rb', line 14

def initialize(stream_prefix:, datetime_format: nil, log_group: nil, log_retention: nil, max_buffer_size: nil, mode: nil, multiline_pattern: nil)
  @stream_prefix = stream_prefix
  Jsii::Type.check_type(@stream_prefix, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "streamPrefix")
  @datetime_format = datetime_format
  Jsii::Type.check_type(@datetime_format, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "datetimeFormat") unless @datetime_format.nil?
  @log_group = log_group
  Jsii::Type.check_type(@log_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19sb2dzLklMb2dHcm91cFJlZiJ9")), "logGroup") unless @log_group.nil?
  @log_retention = log_retention
  Jsii::Type.check_type(@log_retention, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5SZXRlbnRpb25EYXlzIn0=")), "logRetention") unless @log_retention.nil?
  @max_buffer_size = max_buffer_size
  Jsii::Type.check_type(@max_buffer_size, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplIn0=")), "maxBufferSize") unless @max_buffer_size.nil?
  @mode = mode
  Jsii::Type.check_type(@mode, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkF3c0xvZ0RyaXZlck1vZGUifQ==")), "mode") unless @mode.nil?
  @multiline_pattern = multiline_pattern
  Jsii::Type.check_type(@multiline_pattern, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "multilinePattern") unless @multiline_pattern.nil?
end

Instance Attribute Details

#datetime_formatString? (readonly)

Note:

Default: - No multiline matching.

This option defines a multiline start pattern in Python strftime format.

A log message consists of a line that matches the pattern and any following lines that don’t match the pattern. Thus the matched line is the delimiter between log messages.

Returns:

  • (String, nil)


52
53
54
# File 'ecs/aws_log_driver_props.rb', line 52

def datetime_format
  @datetime_format
end

#log_groupAWSCDK::Interfaces::AWSLogs::ILogGroupRef? (readonly)

Note:

Default: - A log group is automatically created.

The log group to log to.



57
58
59
# File 'ecs/aws_log_driver_props.rb', line 57

def log_group
  @log_group
end

#log_retentionAWSCDK::Logs::RetentionDays? (readonly)

Note:

Default: - Logs never expire.

The number of days log events are kept in CloudWatch Logs when the log group is automatically created by this construct.

Returns:



62
63
64
# File 'ecs/aws_log_driver_props.rb', line 62

def log_retention
  @log_retention
end

#max_buffer_sizeAWSCDK::Size? (readonly)

Note:

Default: - 1 megabyte if driver mode is non-blocking, otherwise this property is not set

When AwsLogDriverMode.NON_BLOCKING is configured, this parameter controls the size of the non-blocking buffer used to temporarily store messages. This parameter is not valid with AwsLogDriverMode.BLOCKING.

Returns:



67
68
69
# File 'ecs/aws_log_driver_props.rb', line 67

def max_buffer_size
  @max_buffer_size
end

#modeAWSCDK::ECS::AWSLogDriverMode? (readonly)

Note:

Default: - AwsLogDriverMode.BLOCKING

The delivery mode of log messages from the container to awslogs.



72
73
74
# File 'ecs/aws_log_driver_props.rb', line 72

def mode
  @mode
end

#multiline_patternString? (readonly)

Note:

Default: - No multiline matching.

This option defines a multiline start pattern using a regular expression.

A log message consists of a line that matches the pattern and any following lines that don’t match the pattern. Thus the matched line is the delimiter between log messages.

This option is ignored if datetimeFormat is also configured.

Returns:

  • (String, nil)


83
84
85
# File 'ecs/aws_log_driver_props.rb', line 83

def multiline_pattern
  @multiline_pattern
end

#stream_prefixString (readonly)

Prefix for the log streams.

The awslogs-stream-prefix option allows you to associate a log stream with the specified prefix, the container name, and the ID of the Amazon ECS task to which the container belongs. If you specify a prefix with this option, then the log stream takes the following format:

prefix-name/container-name/ecs-task-id

Returns:

  • (String)


43
44
45
# File 'ecs/aws_log_driver_props.rb', line 43

def stream_prefix
  @stream_prefix
end

Class Method Details

.jsii_propertiesObject



85
86
87
88
89
90
91
92
93
94
95
# File 'ecs/aws_log_driver_props.rb', line 85

def self.jsii_properties
  {
    :stream_prefix => "streamPrefix",
    :datetime_format => "datetimeFormat",
    :log_group => "logGroup",
    :log_retention => "logRetention",
    :max_buffer_size => "maxBufferSize",
    :mode => "mode",
    :multiline_pattern => "multilinePattern",
  }
end

Instance Method Details

#to_jsiiObject



97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'ecs/aws_log_driver_props.rb', line 97

def to_jsii
  result = {}
  result.merge!({
    "streamPrefix" => @stream_prefix,
    "datetimeFormat" => @datetime_format,
    "logGroup" => @log_group,
    "logRetention" => @log_retention,
    "maxBufferSize" => @max_buffer_size,
    "mode" => @mode,
    "multilinePattern" => @multiline_pattern,
  })
  result.compact
end