@Generated(value="jsii-pacmak/1.63.2 (build a8a8833)", date="2022-08-17T17:31:13.866Z") public class LogGroup extends Resource implements ILogGroup
Example:
import software.amazon.awscdk.services.logs.*; LogGroup logGroup = new LogGroup(this, "Log Group"); Bucket logBucket = new Bucket(this, "S3 Bucket"); EmrContainersStartJobRun.Builder.create(this, "EMR Containers Start Job Run") .virtualCluster(VirtualClusterInput.fromVirtualClusterId("de92jdei2910fwedz")) .releaseLabel(ReleaseLabel.EMR_6_2_0) .jobDriver(JobDriver.builder() .sparkSubmitJobDriver(SparkSubmitJobDriver.builder() .entryPoint(TaskInput.fromText("local:///usr/lib/spark/examples/src/main/python/pi.py")) .sparkSubmitParameters("--conf spark.executor.instances=2 --conf spark.executor.memory=2G --conf spark.executor.cores=2 --conf spark.driver.cores=1") .build()) .build()) .monitoring(Monitoring.builder() .logGroup(logGroup) .logBucket(logBucket) .build()) .build();
Modifier and Type | Class and Description |
---|---|
static class |
LogGroup.Builder
A fluent builder for
LogGroup . |
ILogGroup.Jsii$Default, ILogGroup.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
LogGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
LogGroup(software.amazon.jsii.JsiiObjectRef objRef) |
|
LogGroup(software.constructs.Construct scope,
java.lang.String id) |
|
LogGroup(software.constructs.Construct scope,
java.lang.String id,
LogGroupProps props) |
Modifier and Type | Method and Description |
---|---|
MetricFilter |
addMetricFilter(java.lang.String id,
MetricFilterOptions props)
Create a new Metric Filter on this Log Group.
|
LogStream |
addStream(java.lang.String id)
Create a new Log Stream for this Log Group.
|
LogStream |
addStream(java.lang.String id,
StreamOptions props)
Create a new Log Stream for this Log Group.
|
SubscriptionFilter |
addSubscriptionFilter(java.lang.String id,
SubscriptionFilterOptions props)
Create a new Subscription Filter on this Log Group.
|
AddToResourcePolicyResult |
addToResourcePolicy(PolicyStatement statement)
Adds a statement to the resource policy associated with this log group.
|
Metric |
extractMetric(java.lang.String jsonField,
java.lang.String metricNamespace,
java.lang.String metricName)
Extract a metric from structured log events in the LogGroup.
|
static ILogGroup |
fromLogGroupArn(software.constructs.Construct scope,
java.lang.String id,
java.lang.String logGroupArn)
Import an existing LogGroup given its ARN.
|
static ILogGroup |
fromLogGroupName(software.constructs.Construct scope,
java.lang.String id,
java.lang.String logGroupName)
Import an existing LogGroup given its name.
|
java.lang.String |
getLogGroupArn()
The ARN of this log group.
|
java.lang.String |
getLogGroupName()
The name of this log group.
|
Grant |
grant(IGrantable grantee,
java.lang.String... actions)
Give the indicated permissions on this log group and all streams.
|
Grant |
grantWrite(IGrantable grantee)
Give permissions to create and write to streams in this log group.
|
java.lang.String |
logGroupPhysicalName()
Public method to get the physical name of this log group.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyRemovalPolicy, getEnv, getStack
getNode
protected LogGroup(software.amazon.jsii.JsiiObjectRef objRef)
protected LogGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public LogGroup(software.constructs.Construct scope, java.lang.String id, LogGroupProps props)
scope
- This parameter is required.id
- This parameter is required.props
- public LogGroup(software.constructs.Construct scope, java.lang.String id)
scope
- This parameter is required.id
- This parameter is required.public static ILogGroup fromLogGroupArn(software.constructs.Construct scope, java.lang.String id, java.lang.String logGroupArn)
scope
- This parameter is required.id
- This parameter is required.logGroupArn
- This parameter is required.public static ILogGroup fromLogGroupName(software.constructs.Construct scope, java.lang.String id, java.lang.String logGroupName)
scope
- This parameter is required.id
- This parameter is required.logGroupName
- This parameter is required.public MetricFilter addMetricFilter(java.lang.String id, MetricFilterOptions props)
addMetricFilter
in interface ILogGroup
id
- Unique identifier for the construct in its parent. This parameter is required.props
- Properties for creating the MetricFilter. This parameter is required.public LogStream addStream(java.lang.String id, StreamOptions props)
public LogStream addStream(java.lang.String id)
public SubscriptionFilter addSubscriptionFilter(java.lang.String id, SubscriptionFilterOptions props)
addSubscriptionFilter
in interface ILogGroup
id
- Unique identifier for the construct in its parent. This parameter is required.props
- Properties for creating the SubscriptionFilter. This parameter is required.public AddToResourcePolicyResult addToResourcePolicy(PolicyStatement statement)
A resource policy will be automatically created upon the first call to addToResourcePolicy
.
Any ARN Principals inside of the statement will be converted into AWS Account ID strings because CloudWatch Logs Resource Policies do not accept ARN principals.
addToResourcePolicy
in interface IResourceWithPolicy
statement
- The policy statement to add. This parameter is required.public Metric extractMetric(java.lang.String jsonField, java.lang.String metricNamespace, java.lang.String metricName)
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.
extractMetric
in interface ILogGroup
jsonField
- JSON field to extract (example: '$.myfield'). This parameter is required.metricNamespace
- Namespace to emit the metric under. This parameter is required.metricName
- Name to emit the metric under. This parameter is required.public Grant grant(IGrantable grantee, java.lang.String... actions)
public Grant grantWrite(IGrantable grantee)
grantWrite
in interface ILogGroup
grantee
- This parameter is required.public java.lang.String logGroupPhysicalName()
logGroupPhysicalName
in interface ILogGroup
public java.lang.String getLogGroupArn()
getLogGroupArn
in interface ILogGroup
public java.lang.String getLogGroupName()
getLogGroupName
in interface ILogGroup