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
-
#add_metric_filter(id, props) ⇒ AWSCDK::Logs::MetricFilter
Create a new Metric Filter on this Log Group.
-
#add_stream(id, props = nil) ⇒ AWSCDK::Logs::LogStream
Create a new Log Stream for this Log Group.
-
#add_subscription_filter(id, props) ⇒ AWSCDK::Logs::SubscriptionFilter
Create a new Subscription Filter on this Log Group.
-
#add_to_resource_policy(statement) ⇒ AWSCDK::IAM::AddToResourcePolicyResult
Add a statement to the resource's resource policy.
-
#add_transformer(id, props) ⇒ AWSCDK::Logs::Transformer
Create a new Transformer on this Log Group.
-
#apply_removal_policy(policy) ⇒ void
Apply the given removal policy to this resource.
-
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
-
#extract_metric(json_field, metric_namespace, metric_name) ⇒ AWSCDK::CloudWatch::Metric
Extract a metric from structured log events in the LogGroup.
-
#grant(grantee, *actions) ⇒ AWSCDK::IAM::Grant
Give the indicated permissions on this log group and all streams.
-
#grant_read(grantee) ⇒ AWSCDK::IAM::Grant
Give permissions to read from this log group and streams.
-
#grant_write(grantee) ⇒ AWSCDK::IAM::Grant
Give permissions to write to create and write to streams in this log group.
-
#log_group_arn ⇒ String
The ARN of this log group, with ':*' appended.
-
#log_group_name ⇒ String
The name of this log group.
-
#log_group_physical_name ⇒ String
Public method to get the physical name of this log group.
-
#log_group_ref ⇒ AWSCDK::Interfaces::AWSLogs::LogGroupReference
A reference to a LogGroup resource.
-
#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric
Return the given named metric for this Log Group.
-
#metric_incoming_bytes(props = nil) ⇒ AWSCDK::CloudWatch::Metric
The volume of log events in uncompressed bytes uploaded to CloudWatch Logs.
-
#metric_incoming_log_events(props = nil) ⇒ AWSCDK::CloudWatch::Metric
The number of log events uploaded to CloudWatch Logs.
-
#node ⇒ Constructs::Node
The tree node.
-
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Class Method Details
.jsii_overridable_methods ⇒ Object
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.
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.
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.
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.
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).
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 |
#env ⇒ AWSCDK::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.
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.
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.
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.
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_arn ⇒ String
The ARN of this log group, with ':*' appended.
47 48 49 |
# File 'logs/i_log_group.rb', line 47 def log_group_arn() jsii_get_property("logGroupArn") end |
#log_group_name ⇒ String
The name of this log group.
54 55 56 |
# File 'logs/i_log_group.rb', line 54 def log_group_name() jsii_get_property("logGroupName") end |
#log_group_physical_name ⇒ String
Public method to get the physical name of this log group.
199 200 201 |
# File 'logs/i_log_group.rb', line 199 def log_group_physical_name() jsii_call_method("logGroupPhysicalName", []) end |
#log_group_ref ⇒ AWSCDK::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.
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.
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.
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 |
#node ⇒ Constructs::Node
The tree node.
26 27 28 |
# File 'logs/i_log_group.rb', line 26 def node() jsii_get_property("node") end |
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
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.
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 |