Change default rotation for greengrass V2

0

Hello I have a question about GreengrassV2: I've noticed that by default all the log files are rotated every hour whether or not they reached the file size specified in the Nucleus configuration; in addition only 10 log files per component are kept by the rotation before being permanently deleted. What this means is that every log information generated by either Greengrass or a component is permanently lost after 10 hours.

I'm looking for a solution to this, for example how to configure the rotation to happens less frequently than every hour, how to keep more than 10 rotated files or how to configure greengrass so that the rotation it's only based on the file size and not on the time. In GreengrassV1 the log management was much easier and intuitive and i would like to replicate or get a similar result in GreengrassV2; unfortunately for my use case sending logs to cloudwatch is not feasible as the device where I will use Greengrass have a limited amount of network traffic available, so I'm trying to cut all the unnecessary data transfer

Thanks in advance!

FabioG
asked a year ago291 views
2 Answers
2
Accepted Answer

You cannot change the rotation time, logs will always rotate once per hour. There is no limit to the number of log files, only to the total size. This size is configurable: https://docs.aws.amazon.com/greengrass/v2/developerguide/greengrass-nucleus-component.html#greengrass-nucleus-component-configuration:~:text=Default%3A%201024-,totalLogsSizeKB,-(Optional)%20The%20maximum

Change the fileSizeKB and totalLogsSizeKB to be larger in order to retain more logs.

Cheers,

Michael

AWS
EXPERT
answered a year ago
0

Hi Michael, thanks for you quick answer! The problem is that I have modified the file size and the total size:

(Nucleus configuration to merge) { "iotRoleAlias": "GreengrassV2TokenExchangeRoleAlias", "logging": { "level": "INFO", "fileSizeKB": 10240, "totalLogsSizeKB": 102400 }, "interpolateComponentConfiguration": true }

(Nucleus reset paths) [ "/iotRoleAlias", "/logging/level", "/interpolateComponentConfiguration" ]

I just realize now that I might also have to specify the fileSizeKB and totalLogsSizeKB in the reset paths for them to have effect

FabioG
answered a year ago
  • You do not need to add them to reset since you're merging them. The number of files kept per component will be at most totalLogsSizeKB/fileSizeKB. So increase totalLogsSizeKB if you want to keep more logs.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions