Enable logging to CloudWatch logs on my IoT Greengrass core device

0

Hey there,

I've been trying to send the logs of my IoT Greengrass core device to Cloudwatch following this guide. It says to create a deployment and inserting this:

{
  "logsUploaderConfiguration": {
    "systemLogsConfiguration": {
      "uploadToCloudWatch": "true"
    }
  }
}

and this, accordingly:

{
  "logsUploaderConfiguration": {
    "componentLogsConfigurationMap": {
      "com.example.HelloWorld": {
      
      }
    }
  }
}

I just don't get how and where I have to insert those. It's really not explained that much... My last attempt was to create a deployment.json file that looked as follows and push it to AWS through the CLi command aws greengrassv2 create-deployment --cli-input-json file://deployment.json, but that doesn't work:

{
    "targetArn": "arn:aws:iot:<myregion>:<mynumber>:thinggroup/groupname",
    "deploymentName": "test_deployments",
    "components": {
        "aws.greengrass.Cloudwatch": {
            "componentVersion": "3.1.0"
        },
        "aws.greengrass.LogManager": {
            "componentVersion": "2.3.1",
            "logsUploaderConfiguration": {
                "systemLogsConfiguration": {
                    "uploadToCloudWatch": "true"
                },
                "componentLogsConfigurationMap":{
                    "com.example.MyPrivateDockerComponent": {
                        
                    }
                }
            }
        },
        "com.example.MyPrivateDockerComponent": {
            "componentVersion": "1.1.5",
            "runWith": {}
        }
    },
    "deploymentPolicies": {
        "failureHandlingPolicy": "ROLLBACK",
        "componentUpdatePolicy": {
            "timeoutInSeconds": 60,
            "action": "NOTIFY_COMPONENTS"
        }
    },
    "iotJobConfiguration": {
        "jobExecutionsRolloutConfig": {
            "maximumPerMinute": 1000
        }
    },

    "tags": {}
}

Can anyone tell me where to place the "logsUploaderConfiguration" that I can accordingly update my deployment to log to Cloudwatch? Also, is this somehow possible through the AWS console in addition to the CLI? Thanks a lot for your help!

1 Respuesta
2

Review https://docs.aws.amazon.com/greengrass/v2/APIReference/API_CreateDeployment.html for using the API properly.

"aws.greengrass.LogManager": {
    "componentVersion": "2.3.1",
    "configurationUpdate": {
        "merge": "{\"logsUploaderConfiguration\":{\"systemLogsConfiguration\":{\"uploadToCloudWatch\":\"true\"},\"componentLogsConfigurationMap\":{\"com.example.MyPrivateDockerComponent\":{}}}}"
    }
}

You can of course use the Console to do this. Edit the deployment and on the page titled "Configure components - optional", select the radio button next to the log manager component and then click on the button at the top to configure the component.

AWS
EXPERTO
respondido hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas