# Monitoring

Configuration setting for monitoring.

- Source: [`aws-stepfunctions-tasks/lib/emrcontainers/start-job-run.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emrcontainers/start-job-run.ts#L624)
- Type last changed: v2.1.0 · 8 Dec 2021

## Example

TypeScript:

```ts
new tasks.EmrContainersStartJobRun(this, 'EMR Containers Start Job Run', {
  virtualCluster: tasks.VirtualClusterInput.fromVirtualClusterId('de92jdei2910fwedz'),
  releaseLabel: tasks.ReleaseLabel.EMR_6_2_0,
  jobDriver: {
    sparkSubmitJobDriver: {
      entryPoint: sfn.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',
    },
  },
  monitoring: {
    logging: true,
  },
});
```

Python:

```python
tasks.EmrContainersStartJobRun(self, "EMR Containers Start Job Run",
    virtual_cluster=tasks.VirtualClusterInput.from_virtual_cluster_id("de92jdei2910fwedz"),
    release_label=tasks.ReleaseLabel.EMR_6_2_0,
    job_driver=tasks.JobDriver(
        spark_submit_job_driver=tasks.SparkSubmitJobDriver(
            entry_point=sfn.TaskInput.from_text("local:///usr/lib/spark/examples/src/main/python/pi.py"),
            spark_submit_parameters="--conf spark.executor.instances=2 --conf spark.executor.memory=2G --conf spark.executor.cores=2 --conf spark.driver.cores=1"
        )
    ),
    monitoring=tasks.Monitoring(
        logging=True
    )
)
```

Java:

```java
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()
                .logging(true)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
new EmrContainersStartJobRun(this, "EMR Containers Start Job Run", new EmrContainersStartJobRunProps {
    VirtualCluster = VirtualClusterInput.FromVirtualClusterId("de92jdei2910fwedz"),
    ReleaseLabel = ReleaseLabel.EMR_6_2_0,
    JobDriver = new JobDriver {
        SparkSubmitJobDriver = new SparkSubmitJobDriver {
            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"
        }
    },
    Monitoring = new Monitoring {
        Logging = true
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
tasks.NewEmrContainersStartJobRun(this, jsii.String("EMR Containers Start Job Run"), &EmrContainersStartJobRunProps{
	VirtualCluster: tasks.VirtualClusterInput_FromVirtualClusterId(jsii.String("de92jdei2910fwedz")),
	ReleaseLabel: tasks.ReleaseLabel_EMR_6_2_0(),
	JobDriver: &JobDriver{
		SparkSubmitJobDriver: &SparkSubmitJobDriver{
			EntryPoint: sfn.TaskInput_FromText(jsii.String("local:///usr/lib/spark/examples/src/main/python/pi.py")),
			SparkSubmitParameters: jsii.String("--conf spark.executor.instances=2 --conf spark.executor.memory=2G --conf spark.executor.cores=2 --conf spark.driver.cores=1"),
		},
	},
	Monitoring: &Monitoring{
		Logging: jsii.Boolean(true),
	},
})
```

## Properties

- `logBucket`: [IBucket](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.IBucket.html) — Amazon S3 Bucket for monitoring log publishing.

  **Default:** if `logging` is manually set to `true` and a `logBucket` is not provided, a `logBucket` will be automatically generated`.

  You can configure your jobs to send log information to Amazon S3.

- `logging`: boolean — Enable logging for this job.

  **Default:** true - true if values are provided for `logGroup` or `logBucket`, false otherwise

  If set to true, will automatically create a Cloudwatch Log Group and S3 bucket.
  This will be set to `true` implicitly if values are provided for `logGroup` or `logBucket`.

- `logGroup`: [ILogGroup](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.ILogGroup.html) — A log group for CloudWatch monitoring.

  **Default:** if `logging` is manually set to `true` and a `logGroup` is not provided, a `logGroup` will be automatically generated`.

  You can configure your jobs to send log information to CloudWatch Logs.

- `logStreamNamePrefix`: string — A log stream name prefix for Cloudwatch monitoring.

  **Default:** Log streams created in this log group have no default prefix

- `persistentAppUI`: boolean = true — Monitoring configurations for the persistent application UI.
