Using greengrass-cli logs command from within a component

0

Setup details:

Greengrass V2 on ubuntu 18.04 GG Nucleus 2.9.2 with json logs, and GG Cli Deployed (2.9.2, with config "AuthorizedPosixGroups": "ggc_group")

I would like to be able to check a greengrass component's logs from within a greengrass component. I am already successfully using the greengrass-cli from one component to restart another.

Is it possible to run:

/greengrass/v2/bin/greengrass-cli logs get --verbose \
    --log-file /greengrass/v2/logs/<componentName>.log \
    --time-window -10sec

from another component ? When i run that, I get the error: Cannot find file: /greengrass/v2/logs/<componentName>.log''.

Does the logfile itself have to be readable by the ggc_user in order to use the logs command on it ?

已提问 1 年前236 查看次数
1 回答
0
已接受的回答

That log directory is only readable by root by default. ggc_user won't be able to access it. You would need to run your component as root as well. Standard disclaimer: please understand the security implications if you choose to go that route. I would not recommend it.

Alternatively, you could configure the other component to log directly to a readable directory, rather than printing to stdout and having Nucleus write the logs to disk. Is this an option for you?

AWS
已回答 1 年前
  • That is an option, though it would have been nice to be able to use the existing greengrass logs, from within greengrass logs. Thanks for the answer.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则