Skip to content
GitHubXDiscord

LoggerDefinitionVersion

The LoggerDefinitionVersion resource allows you to manage logger definitions for AWS Greengrass, enabling you to control logging configurations for your Greengrass components. For more details, refer to the AWS Greengrass LoggerDefinitionVersions documentation.

Create a basic LoggerDefinitionVersion with required properties.

import AWS from "alchemy/aws/control";
const loggerDefinitionVersion = await AWS.Greengrass.LoggerDefinitionVersion("basicLoggerDefinitionVersion", {
LoggerDefinitionId: "myLoggerDefinitionId",
Loggers: [
{
LoggerId: "myLogger",
Level: "INFO",
Space: 1024,
Type: "File"
}
]
});

Configure a LoggerDefinitionVersion with multiple loggers and an optional adoption flag.

const advancedLoggerDefinitionVersion = await AWS.Greengrass.LoggerDefinitionVersion("advancedLoggerDefinitionVersion", {
LoggerDefinitionId: "myAdvancedLoggerDefinitionId",
Loggers: [
{
LoggerId: "myFileLogger",
Level: "DEBUG",
Space: 2048,
Type: "File"
},
{
LoggerId: "myStreamLogger",
Level: "ERROR",
Space: 512,
Type: "Stream"
}
],
adopt: true // Indicates to adopt existing resources instead of failing
});

Create a LoggerDefinitionVersion with a custom logger configuration for a stream logger.

const customLoggerDefinitionVersion = await AWS.Greengrass.LoggerDefinitionVersion("customLoggerDefinitionVersion", {
LoggerDefinitionId: "myCustomLoggerDefinitionId",
Loggers: [
{
LoggerId: "myCustomStreamLogger",
Level: "WARN",
Space: 512,
Type: "Stream"
}
]
});

Define a LoggerDefinitionVersion with multiple loggers for different log levels.

const multipleLoggersDefinitionVersion = await AWS.Greengrass.LoggerDefinitionVersion("multipleLoggersDefinitionVersion", {
LoggerDefinitionId: "myMultipleLoggersId",
Loggers: [
{
LoggerId: "infoLogger",
Level: "INFO",
Space: 1024,
Type: "File"
},
{
LoggerId: "errorLogger",
Level: "ERROR",
Space: 2048,
Type: "File"
},
{
LoggerId: "debugLogger",
Level: "DEBUG",
Space: 1024,
Type: "Stream"
}
]
});