Skip to content
v2.273.0

JsonFileLogDriver Class ​

A log driver that sends log information to json-file Logs.

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 jsonFileLogDriver = new ecs.JsonFileLogDriver(/* all optional props */ {
  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 = ecs.JsonFileLogDriver(
    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.*;

JsonFileLogDriver jsonFileLogDriver = JsonFileLogDriver.Builder.create()
        .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 jsonFileLogDriver = new JsonFileLogDriver(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"

jsonFileLogDriver := awscdk.Aws_ecs.NewJsonFileLogDriver(&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"),
})

Initializer ​

ts
new JsonFileLogDriver(props?: JsonFileLogDriverProps)
python
JsonFileLogDriver(props: typing.Optional[JsonFileLogDriverProps] = None)
java
new JsonFileLogDriver(JsonFileLogDriverProps props)
csharp
new JsonFileLogDriver(JsonFileLogDriverProps? props = null)
go
NewJsonFileLogDriver(Props JsonFileLogDriverProps)

Methods ​

awsLogs(props: AwsLogDriverProps): LogDriver@staticmethod def aws_logs(props: AwsLogDriverProps) -> LogDriverpublic static LogDriver awsLogs(AwsLogDriverProps props)public static LogDriver AwsLogs(AwsLogDriverProps props)func AwsLogs(Props AwsLogDriverProps) LogDriverstatic#
Creates a log driver configuration that sends log information to CloudWatch Logs.
bind(_scope: Construct, _containerDefinition: ContainerDefinition): LogDriverConfigdef bind(self, _scope: Construct, _container_definition: ContainerDefinition) -> LogDriverConfigpublic LogDriverConfig bind(Construct _scope, ContainerDefinition _containerDefinition)public LogDriverConfig Bind(Construct _scope, ContainerDefinition _containerDefinition)func Bind(_scope Construct, _containerDefinition ContainerDefinition) LogDriverConfig#
Called when the log driver is configured on a container.