Class: AWSCDK::ECS::JsonFileLogDriverProps

Inherits:
BaseLogDriverProps
  • Object
show all
Defined in:
ecs/json_file_log_driver_props.rb

Overview

Specifies the json-file log driver configuration options.

Source

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env: nil, env_regex: nil, labels: nil, tag: nil, compress: nil, max_file: nil, max_size: nil) ⇒ JsonFileLogDriverProps

Returns a new instance of JsonFileLogDriverProps.

Parameters:

  • env (Array<String>, nil) (defaults to: nil)

    The env option takes an array of keys.

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

    The env-regex option is similar to and compatible with env.

  • labels (Array<String>, nil) (defaults to: nil)

    The labels option takes an array of keys.

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

    By default, Docker uses the first 12 characters of the container ID to tag log messages.

  • compress (Boolean, nil) (defaults to: nil)

    Toggles compression for rotated logs.

  • max_file (Numeric, nil) (defaults to: nil)

    The maximum number of log files that can be present.

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

    The maximum size of the log before it is rolled.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'ecs/json_file_log_driver_props.rb', line 16

def initialize(env: nil, env_regex: nil, labels: nil, tag: nil, compress: nil, max_file: nil, max_size: nil)
  @env = env
  Jsii::Type.check_type(@env, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "env") unless @env.nil?
  @env_regex = env_regex
  Jsii::Type.check_type(@env_regex, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "envRegex") unless @env_regex.nil?
  @labels = labels
  Jsii::Type.check_type(@labels, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "labels") unless @labels.nil?
  @tag = tag
  Jsii::Type.check_type(@tag, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "tag") unless @tag.nil?
  @compress = compress
  Jsii::Type.check_type(@compress, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "compress") unless @compress.nil?
  @max_file = max_file
  Jsii::Type.check_type(@max_file, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxFile") unless @max_file.nil?
  @max_size = max_size
  Jsii::Type.check_type(@max_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "maxSize") unless @max_size.nil?
end

Instance Attribute Details

#compressBoolean? (readonly)

Note:

Default: - false

Toggles compression for rotated logs.

Returns:

  • (Boolean, nil)


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

def compress
  @compress
end

#envArray<String>? (readonly)

Note:

Default: - No env

The env option takes an array of keys.

If there is collision between label and env keys, the value of the env takes precedence. Adds additional fields to the extra attributes of a logging message.

Returns:

  • (Array<String>, nil)


41
42
43
# File 'ecs/json_file_log_driver_props.rb', line 41

def env
  @env
end

#env_regexString? (readonly)

Note:

Default: - No envRegex

The env-regex option is similar to and compatible with env.

Its value is a regular expression to match logging-related environment variables. It is used for advanced log tag options.

Returns:

  • (String, nil)


50
51
52
# File 'ecs/json_file_log_driver_props.rb', line 50

def env_regex
  @env_regex
end

#labelsArray<String>? (readonly)

Note:

Default: - No labels

The labels option takes an array of keys.

If there is collision between label and env keys, the value of the env takes precedence. Adds additional fields to the extra attributes of a logging message.

Returns:

  • (Array<String>, nil)


59
60
61
# File 'ecs/json_file_log_driver_props.rb', line 59

def labels
  @labels
end

#max_fileNumeric? (readonly)

Note:

Default: - 1

The maximum number of log files that can be present.

If rolling the logs creates excess files, the oldest file is removed. Only effective when max-size is also set. A positive integer.

Returns:

  • (Numeric, nil)


81
82
83
# File 'ecs/json_file_log_driver_props.rb', line 81

def max_file
  @max_file
end

#max_sizeString? (readonly)

Note:

Default: - -1 (unlimited)

The maximum size of the log before it is rolled.

A positive integer plus a modifier representing the unit of measure (k, m, or g).

Returns:

  • (String, nil)


89
90
91
# File 'ecs/json_file_log_driver_props.rb', line 89

def max_size
  @max_size
end

#tagString? (readonly)

Note:

Default: - The first 12 characters of the container ID

By default, Docker uses the first 12 characters of the container ID to tag log messages.

Refer to the log tag option documentation for customizing the log tag format.

Returns:

  • (String, nil)


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

def tag
  @tag
end

Class Method Details

.jsii_propertiesObject



91
92
93
94
95
96
97
98
99
100
101
# File 'ecs/json_file_log_driver_props.rb', line 91

def self.jsii_properties
  {
    :env => "env",
    :env_regex => "envRegex",
    :labels => "labels",
    :tag => "tag",
    :compress => "compress",
    :max_file => "maxFile",
    :max_size => "maxSize",
  }
end

Instance Method Details

#to_jsiiObject



103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'ecs/json_file_log_driver_props.rb', line 103

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "env" => @env,
    "envRegex" => @env_regex,
    "labels" => @labels,
    "tag" => @tag,
    "compress" => @compress,
    "maxFile" => @max_file,
    "maxSize" => @max_size,
  })
  result.compact
end