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 ?

posta un anno fa235 visualizzazioni
1 Risposta
0
Risposta accettata

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
con risposta un anno fa
  • 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.

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande