Skip to main content

loggings

Creates, updates, deletes or gets a logging resource or lists loggings in a region

Overview

Nameloggings
TypeResource
DescriptionLogging Options enable you to configure your IoT V2 logging role and default logging level so that you can monitor progress events logs as it passes from your devices through Iot core service.
Idaws.iot.loggings

Fields

NameDatatypeDescription
account_idstringYour 12-digit account ID (used as the primary identifier for the CloudFormation resource).
role_arnstringThe ARN of the role that allows IoT to write to Cloudwatch logs.
default_log_levelstringThe log level to use. Valid values are: ERROR, WARN, INFO, DEBUG, or DISABLED.
regionstringAWS region.

Methods

NameAccessible byRequired Params
create_resourceINSERTAccountId, RoleArn, DefaultLogLevel, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all loggings in a region.

SELECT
region,
account_id,
role_arn,
default_log_level
FROM aws.iot.loggings
WHERE region = 'us-east-1';

Gets all properties from an individual logging.

SELECT
region,
account_id,
role_arn,
default_log_level
FROM aws.iot.loggings
WHERE region = 'us-east-1' AND data__Identifier = '<AccountId>';

INSERT example

Use the following StackQL query and manifest file to create a new logging resource, using stack-deploy.

/*+ create */
INSERT INTO aws.iot.loggings (
AccountId,
RoleArn,
DefaultLogLevel,
region
)
SELECT
'{{ AccountId }}',
'{{ RoleArn }}',
'{{ DefaultLogLevel }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM aws.iot.loggings
WHERE data__Identifier = '<AccountId>'
AND region = 'us-east-1';

Permissions

To operate on the loggings resource, the following permissions are required:

Create

iot:SetV2LoggingOptions,
iot:GetV2LoggingOptions,
iam:PassRole

Read

iot:GetV2LoggingOptions

Update

iot:SetV2LoggingOptions,
iot:GetV2LoggingOptions,
iam:PassRole

Delete

iot:SetV2LoggingOptions,
iot:GetV2LoggingOptions

List

iot:GetV2LoggingOptions