AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::IoT::Logging

CfnLogging

Configure logging. > If you already set the log function of AWS IoT Core , you can't deploy the Cloud Development Kit to change the logging settings. You can change the logging settings by either: > > - Importing the existing logging resource into your CloudFormation stack, such as with the [infrastructure as code generator (IaC generator)](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/generate-IaC.html) . > - Calling `aws iot set-v2-logging-options --disable-all-logs` before creating a new CloudFormation stack. This command disables all AWS IoT logging. As a result, no AWS IoT logs will be delivered to Amazon CloudWatch until you re-enable logging.

Import

import { CfnLogging } from 'aws-cdk-lib/aws-iot';

Or use the module namespace:

import * as iot from 'aws-cdk-lib/aws-iot';
// iot.CfnLogging

Properties

Configuration passed to the constructor as CfnLoggingProps.

accountIdRequired
string

The account ID.

defaultLogLevelRequired
string

The default log level. Valid Values: `DEBUG | INFO | ERROR | WARN | DISABLED`

roleArnRequired
string | IRoleRef

The role ARN used for the log.

eventConfigurationsOptional
IResolvable | IResolvable | EventConfigurationProperty[]

Configurations for event-based logging that specifies which event types to log and their logging settings. Overrides account-level logging for the specified event

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter