Skip to content

PM2 logging configuration for JSON format #2663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nidhhoggr opened this issue Jan 25, 2017 · 2 comments
Closed

PM2 logging configuration for JSON format #2663

nidhhoggr opened this issue Jan 25, 2017 · 2 comments

Comments

@nidhhoggr
Copy link

With the latest version of PM2 there is the ability to output all logs in JSON with the following command:

pm2 logs --json

PM2 already writes all the log in the ~/.pm2/logs folder respectively. The issue is, the format
of these logs are not in JSON and it seems there is no option in the configuration to force the
format of the output to be JSON instead.

Is there something in the documentation I am missing?

A work around is writing a deamon to spawn individual processes and redirect all STDOUT of pm2 logs [app_name] --json to ~/.pm2/logs/[app_name]-[process_id]-[type].log I am hoping that something is built in PM2 to care on this instead.

@vmarchaud
Copy link
Contributor

Published PM2 2.4.0

@seven-deuce
Copy link

It is not in the documentation, but as far as I could read the source code in new version, this is possible by adding this to the ecosystem config file:

log_type : 'json'

topkat added a commit to topkat/pm2-hive.github.io that referenced this issue May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants