Module: AWSCDK::Logs::ILogGroup

Includes:
IAM::IResourceWithPolicy, Interfaces::AWSLogs::ILogGroupRef
Included in:
LogGroup
Defined in:
logs/i_log_group.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'logs/i_log_group.rb', line 241

def self.jsii_overridable_methods
  {
    :env => { kind: :property, name: "env", is_optional: false },
    :node => { kind: :property, name: "node", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :log_group_ref => { kind: :property, name: "logGroupRef", is_optional: false },
    :log_group_arn => { kind: :property, name: "logGroupArn", is_optional: false },
    :log_group_name => { kind: :property, name: "logGroupName", is_optional: false },
    :add_to_resource_policy => { kind: :method, name: "addToResourcePolicy", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :add_metric_filter => { kind: :method, name: "addMetricFilter", is_optional: false },
    :add_stream => { kind: :method, name: "addStream", is_optional: false },
    :add_subscription_filter => { kind: :method, name: "addSubscriptionFilter", is_optional: false },
    :add_transformer => { kind: :method, name: "addTransformer", is_optional: false },
    :extract_metric => { kind: :method, name: "extractMetric", is_optional: false },
    :grant => { kind: :method, name: "grant", is_optional: false },
    :grant_read => { kind: :method, name: "grantRead", is_optional: false },
    :grant_write => { kind: :method, name: "grantWrite", is_optional: false },
    :log_group_physical_name => { kind: :method, name: "logGroupPhysicalName", is_optional: false },
    :metric => { kind: :method, name: "metric", is_optional: false },
    :metric_incoming_bytes => { kind: :method, name: "metricIncomingBytes", is_optional: false },
    :metric_incoming_log_events => { kind: :method, name: "metricIncomingLogEvents", is_optional: false },
  }
end

Instance Method Details

#add_metric_filter(id, props) ⇒ AWSCDK::Logs::MetricFilter

Create a new Metric Filter on this Log Group.

Parameters:

Returns:



103
104
105
106
107
108
# File 'logs/i_log_group.rb', line 103

def add_metric_filter(id, props)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  props = props.is_a?(Hash) ? ::AWSCDK::Logs::MetricFilterOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5NZXRyaWNGaWx0ZXJPcHRpb25zIn0=")), "props")
  jsii_call_method("addMetricFilter", [id, props])
end

#add_stream(id, props = nil) ⇒ AWSCDK::Logs::LogStream

Create a new Log Stream for this Log Group.

Parameters:

  • id (String)

    Unique identifier for the construct in its parent.

  • props (AWSCDK::Logs::StreamOptions, nil) (defaults to: nil)

    Properties for creating the LogStream.

Returns:



115
116
117
118
119
120
# File 'logs/i_log_group.rb', line 115

def add_stream(id, props = nil)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  props = props.is_a?(Hash) ? ::AWSCDK::Logs::StreamOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5TdHJlYW1PcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("addStream", [id, props])
end

#add_subscription_filter(id, props) ⇒ AWSCDK::Logs::SubscriptionFilter

Create a new Subscription Filter on this Log Group.

Parameters:

Returns:



127
128
129
130
131
132
# File 'logs/i_log_group.rb', line 127

def add_subscription_filter(id, props)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  props = props.is_a?(Hash) ? ::AWSCDK::Logs::SubscriptionFilterOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5TdWJzY3JpcHRpb25GaWx0ZXJPcHRpb25zIn0=")), "props")
  jsii_call_method("addSubscriptionFilter", [id, props])
end

#add_to_resource_policy(statement) ⇒ AWSCDK::IAM::AddToResourcePolicyResult

Add a statement to the resource's resource policy.



62
63
64
65
# File 'logs/i_log_group.rb', line 62

def add_to_resource_policy(statement)
  Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement")
  jsii_call_method("addToResourcePolicy", [statement])
end

#add_transformer(id, props) ⇒ AWSCDK::Logs::Transformer

Create a new Transformer on this Log Group.

Parameters:

Returns:



139
140
141
142
143
144
# File 'logs/i_log_group.rb', line 139

def add_transformer(id, props)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  props = props.is_a?(Hash) ? ::AWSCDK::Logs::TransformerOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5UcmFuc2Zvcm1lck9wdGlvbnMifQ==")), "props")
  jsii_call_method("addTransformer", [id, props])
end

#apply_removal_policy(policy) ⇒ void

This method returns an undefined value.

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:



93
94
95
96
# File 'logs/i_log_group.rb', line 93

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
end

#envAWSCDK::Interfaces::ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.



19
20
21
# File 'logs/i_log_group.rb', line 19

def env()
  jsii_get_property("env")
end

#extract_metric(json_field, metric_namespace, metric_name) ⇒ AWSCDK::CloudWatch::Metric

Extract a metric from structured log events in the LogGroup.

Creates a MetricFilter on this LogGroup that will extract the value of the indicated JSON field in all records where it occurs.

The metric will be available in CloudWatch Metrics under the indicated namespace and name.

Parameters:

  • json_field (String)

    JSON field to extract (example: '$.myfield').

  • metric_namespace (String)

    Namespace to emit the metric under.

  • metric_name (String)

    Name to emit the metric under.

Returns:



158
159
160
161
162
163
# File 'logs/i_log_group.rb', line 158

def extract_metric(json_field, metric_namespace, metric_name)
  Jsii::Type.check_type(json_field, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "jsonField")
  Jsii::Type.check_type(metric_namespace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricNamespace")
  Jsii::Type.check_type(metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  jsii_call_method("extractMetric", [json_field, metric_namespace, metric_name])
end

#grant(grantee, *actions) ⇒ AWSCDK::IAM::Grant

Give the indicated permissions on this log group and all streams.

Parameters:

Returns:



170
171
172
173
174
175
176
# File 'logs/i_log_group.rb', line 170

def grant(grantee, *actions)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  actions.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "actions[#{index}]")
  end
  jsii_call_method("grant", [grantee, *actions])
end

#grant_read(grantee) ⇒ AWSCDK::IAM::Grant

Give permissions to read from this log group and streams.

Parameters:

Returns:



182
183
184
185
# File 'logs/i_log_group.rb', line 182

def grant_read(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantRead", [grantee])
end

#grant_write(grantee) ⇒ AWSCDK::IAM::Grant

Give permissions to write to create and write to streams in this log group.

Parameters:

Returns:



191
192
193
194
# File 'logs/i_log_group.rb', line 191

def grant_write(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantWrite", [grantee])
end

#log_group_arnString

The ARN of this log group, with ':*' appended.

Returns:

  • (String)


47
48
49
# File 'logs/i_log_group.rb', line 47

def log_group_arn()
  jsii_get_property("logGroupArn")
end

#log_group_nameString

The name of this log group.

Returns:

  • (String)


54
55
56
# File 'logs/i_log_group.rb', line 54

def log_group_name()
  jsii_get_property("logGroupName")
end

#log_group_physical_nameString

Public method to get the physical name of this log group.

Returns:

  • (String)


199
200
201
# File 'logs/i_log_group.rb', line 199

def log_group_physical_name()
  jsii_call_method("logGroupPhysicalName", [])
end

#log_group_refAWSCDK::Interfaces::AWSLogs::LogGroupReference

A reference to a LogGroup resource.



40
41
42
# File 'logs/i_log_group.rb', line 40

def log_group_ref()
  jsii_get_property("logGroupRef")
end

#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return the given named metric for this Log Group.

Parameters:

Returns:



208
209
210
211
212
213
# File 'logs/i_log_group.rb', line 208

def metric(metric_name, props = nil)
  Jsii::Type.check_type(metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metric", [metric_name, props])
end

#metric_incoming_bytes(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The volume of log events in uncompressed bytes uploaded to CloudWatch Logs.

When used with the LogGroupName dimension, this is the volume of log events in uncompressed bytes uploaded to the log group.

Parameters:

Returns:



222
223
224
225
226
# File 'logs/i_log_group.rb', line 222

def metric_incoming_bytes(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricIncomingBytes", [props])
end

#metric_incoming_log_events(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The number of log events uploaded to CloudWatch Logs.

When used with the LogGroupName dimension, this is the number of log events uploaded to the log group.

Parameters:

Returns:



235
236
237
238
239
# File 'logs/i_log_group.rb', line 235

def metric_incoming_log_events(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricIncomingLogEvents", [props])
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


26
27
28
# File 'logs/i_log_group.rb', line 26

def node()
  jsii_get_property("node")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



33
34
35
# File 'logs/i_log_group.rb', line 33

def stack()
  jsii_get_property("stack")
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



74
75
76
77
78
79
# File 'logs/i_log_group.rb', line 74

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end