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 ?

gefragt vor einem Jahr234 Aufrufe
1 Antwort
0
Akzeptierte Antwort

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
beantwortet vor einem Jahr
  • 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.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen