Install the AWS IoT Greengrass log manager component on the device
Note
Be aware of the CloudWatch quotas.
Follow these procedures to configure the Amazon Kinesis Video Streams Edge Agent logs to automatically upload to CloudWatch using the AWS IoT Greengrass log manager component. This is an optional step.
Install the AWS IoT Greengrass log manager component
-
Confirm that the AWS IoT Greengrass device role has the appropriate permissions.
Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/
. -
Click Roles in the left navigation.
-
Choose the name of the TES role created in Set up the AWS IoT Greengrass V2 core device on the device. Use the search bar if necessary.
-
Select the
GreengrassV2TokenExchangeRoleAccess
policy. -
Select the JSON tab and verify that the policy looks like the following:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents", "logs:DescribeLogStreams", "s3:GetBucketLocation" ], "Resource": "*" } ] }
-
If the
GreengrassV2TokenExchangeRoleAccess
policy doesn't exist, or if some required permissions are missing, create a new IAM policy with these permissions and attach it to the TES role created in Set up the AWS IoT Greengrass V2 core device on the device.
-
Sign in to the AWS Management Console and open the AWS IoT Core console at https://console.aws.amazon.com/iot/
. Verify that the appropriate Region is selected. -
In the left navigation, choose Greengrass devices, Deployments.
Choose the deployment with the same target as the thing you created in Set up the AWS IoT Greengrass V2 core device on the device.
-
In the top right corner, select Actions, then choose Revise.
In the pop-up that appears, choose Revise deployment.
-
Complete the following sections:
-
Step 1: Specify target. Choose Next.
-
Step 2: Select components.
-
Verify that the aws.greengrass.Cli component and aws.greengrass.SecretManager components are still selected.
Important
Don't uninstall these components.
-
Toggle the Show only selected components switch and search for aws.greengrass.LogManager.
-
Select the box next to aws.greengrass.LogManager, then choose Next.
-
-
Step 3: Configure components. Configure the AWS IoT Greengrass log manager component to upload the logs generated by the Amazon Kinesis Video Streams Edge Agent.
Select the aws.greengrass.LogManager component, then choose Configure component.
In the screen that appears, paste the following log manager configuration in the Configuration to merge box.
{ "logsUploaderConfiguration": { "componentLogsConfigurationMap": { "aws.kinesisvideo.KvsEdgeComponent/java_kvs.log": { "diskSpaceLimit": "
100
", "diskSpaceLimitUnit": "MB", "logFileDirectoryPath": "/greengrass
/v2
/work/aws.kinesisvideo.KvsEdgeComponent/log", "logFileRegex": "java_kvs.log\\w*" }, "aws.kinesisvideo.KvsEdgeComponent/cpp_kvs_edge.log": { "diskSpaceLimit": "100
", "diskSpaceLimitUnit": "MB", "logFileDirectoryPath": "/greengrass
/v2
/work/aws.kinesisvideo.KvsEdgeComponent/log", "logFileRegex": "cpp_kvs_edge.log\\w*" }, "aws.kinesisvideo.KvsEdgeComponent/cpp_kvssink.log": { "diskSpaceLimit": "100
", "diskSpaceLimitUnit": "MB", "logFileDirectoryPath": "/greengrass
/v2
/work/aws.kinesisvideo.KvsEdgeComponent/log", "logFileRegex": "cpp_kvssink.log\\w*" }, "aws.kinesisvideo.KvsEdgeComponent/cpp_kvs_streams.log": { "diskSpaceLimit": "100
", "diskSpaceLimitUnit": "MB", "logFileDirectoryPath": "/greengrass
/v2
/work/aws.kinesisvideo.KvsEdgeComponent/log", "logFileRegex": "cpp_kvs_streams.log\\w*" } } }, "periodicUploadIntervalSec": "1
" }Important
The
logFileDirectoryPath
in the preceding configuration assumes that the default logging output location is used.Note
For more information about each of the parameters for the log manager configuration, see the Log manager section of the AWS IoT Greengrass Version 2 Developer Guide.
Once you finish, select Confirm, then choose Next.
-
Step 4: Configure advanced settings. Select Next.
-
Step 5: Review. Select Deploy.
-
-
Confirm that the AWS log manager component and permissions were installed correctly.
-
On the Ubuntu Amazon EC2 instance, type
sudo /greengrass/v2/bin/greengrass-cli component details --name aws.greengrass.LogManager
to verify the component received the updated configuration. -
Inspect the AWS IoT Greengrass core logs.
Type
sudo less /greengrass/v2/logs/greengrass.log
.Review for deployment errors.
If there was an error, revise the deployment to remove the
aws.greengrass.LogManager
component.Type
sudo service greengrass restart
to restart the AWS IoT Greengrass core service.If the deployment error was related to missing permissions, review Add permissions to the token exchange service (TES) role to make sure that the TES role has proper permissions. Then, repeat this section.