loggings
Creates, updates, deletes or gets a logging resource or lists loggings in a region
Overview
| Name | loggings |
| Type | Resource |
| Description | Logging 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. |
| Id | awscc.iot.loggings |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
account_id | string | Your 12-digit account ID (used as the primary identifier for the CloudFormation resource). |
role_arn | string | The ARN of the role that allows IoT to write to Cloudwatch logs. |
default_log_level | string | The log level to use. Valid values are: ERROR, WARN, INFO, DEBUG, or DISABLED. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
account_id | string | Your 12-digit account ID (used as the primary identifier for the CloudFormation resource). |
region | string | AWS region. |
For more information, see AWS::IoT::Logging.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | loggings | INSERT | AccountId, RoleArn, DefaultLogLevel, region |
delete_resource | loggings | DELETE | Identifier, region |
update_resource | loggings | UPDATE | Identifier, PatchDocument, region |
list_resources | loggings_list_only | SELECT | region |
get_resource | loggings | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual logging.
SELECT
region,
account_id,
role_arn,
default_log_level
FROM awscc.iot.loggings
WHERE
region = '{{ region }}' AND
Identifier = '{{ account_id }}';
Lists all loggings in a region.
SELECT
region,
account_id
FROM awscc.iot.loggings_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new logging resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.iot.loggings (
AccountId,
RoleArn,
DefaultLogLevel,
region
)
SELECT
'{{ account_id }}',
'{{ role_arn }}',
'{{ default_log_level }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.iot.loggings (
AccountId,
RoleArn,
DefaultLogLevel,
region
)
SELECT
'{{ account_id }}',
'{{ role_arn }}',
'{{ default_log_level }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: logging
props:
- name: account_id
value: '{{ account_id }}'
- name: role_arn
value: '{{ role_arn }}'
- name: default_log_level
value: '{{ default_log_level }}'
UPDATE example
Use the following StackQL query and manifest file to update a logging resource, using stack-deploy.
/*+ update */
UPDATE awscc.iot.loggings
SET PatchDocument = string('{{ {
"RoleArn": role_arn,
"DefaultLogLevel": default_log_level
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ account_id }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.iot.loggings
WHERE
Identifier = '{{ account_id }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the loggings resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
iot:SetV2LoggingOptions,
iot:GetV2LoggingOptions,
iam:PassRole
iot:GetV2LoggingOptions
iot:SetV2LoggingOptions,
iot:GetV2LoggingOptions,
iam:PassRole
iot:SetV2LoggingOptions,
iot:GetV2LoggingOptions
iot:GetV2LoggingOptions