Skip to content
v2.278.0

JsonFileLogDriverProps Struct ​

Specifies the json-file log driver configuration options.

Source

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';
const jsonFileLogDriverProps: ecs.JsonFileLogDriverProps = {
  compress: false,
  env: ['env'],
  envRegex: 'envRegex',
  labels: ['labels'],
  maxFile: 123,
  maxSize: 'maxSize',
  tag: 'tag',
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ecs as ecs

json_file_log_driver_props = ecs.JsonFileLogDriverProps(
    compress=False,
    env=["env"],
    env_regex="envRegex",
    labels=["labels"],
    max_file=123,
    max_size="maxSize",
    tag="tag"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ecs.*;

JsonFileLogDriverProps jsonFileLogDriverProps = JsonFileLogDriverProps.builder()
        .compress(false)
        .env(List.of("env"))
        .envRegex("envRegex")
        .labels(List.of("labels"))
        .maxFile(123)
        .maxSize("maxSize")
        .tag("tag")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ECS;

var jsonFileLogDriverProps = new JsonFileLogDriverProps {
    Compress = false,
    Env = new [] { "env" },
    EnvRegex = "envRegex",
    Labels = new [] { "labels" },
    MaxFile = 123,
    MaxSize = "maxSize",
    Tag = "tag"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

jsonFileLogDriverProps := &JsonFileLogDriverProps{
	Compress: jsii.Boolean(false),
	Env: []*string{
		jsii.String("env"),
	},
	EnvRegex: jsii.String("envRegex"),
	Labels: []*string{
		jsii.String("labels"),
	},
	MaxFile: jsii.Number(123),
	MaxSize: jsii.String("maxSize"),
	Tag: jsii.String("tag"),
}

Properties ​

compressoptionalbooleancompressoptionalboolcompressoptionalBooleanCompressoptionalboolCompressoptional*bool = false #
Toggles compression for rotated logs.
envoptionalstring[]envoptionaltyping.List[str]envoptionalList<String>Envoptionalstring[]Envoptional*[]*string #
The env option takes an array of keys.

Default: No env

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.

envRegexoptionalstringenv_regexoptionalstrenvRegexoptionalStringEnvRegexoptionalstringEnvRegexoptional*string #
The env-regex option is similar to and compatible with env.

Default: No envRegex

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

labelsoptionalstring[]labelsoptionaltyping.List[str]labelsoptionalList<String>Labelsoptionalstring[]Labelsoptional*[]*string #
The labels option takes an array of keys.

Default: No labels

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.

maxFileoptionalnumbermax_fileoptionalint | floatmaxFileoptionalNumberMaxFileoptionaldoubleMaxFileoptional*float64 = 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.

maxSizeoptionalstringmax_sizeoptionalstrmaxSizeoptionalStringMaxSizeoptionalstringMaxSizeoptional*string #
The maximum size of the log before it is rolled.

Default: -1 (unlimited)

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

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

Default: The first 12 characters of the container ID

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