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 ?

demandé il y a un an236 vues
1 réponse
0
Réponse acceptée

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
répondu il y a un an
  • 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.

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions