How do you find the log of a pm2?

How do you find the log of a pm2?

Type pm2 log in a shell and you get an overview of the last 15 log lines and the last 15 error lines in realtime. At the top of these log lines, the location of your logfile is shown. You can also type pm2 log –lines 1000 to show more lines, in this case 1000.

How do I clear pm2 logs?

PM2 LOGS COMMANDS :

  1. Show logs pm2 logs appName|appId –lines=100.
  2. Show Error logs pm2 logs appName|appId –err –lines=100.
  3. Empty log for specific app pm2 flush appName|appId.
  4. Empty all log files pm2 flush.
  5. Reload all logs pm2 reloadLogs.

How do I rotate a pm2 log?

pm2 set pm2-logrotate:compress true (compress logs when rotated) pm2 set pm2-logrotate:rotateInterval ‘*/1 * * * *’ (force rotate every minute)

How do I refresh pm2 logs?

  1. first update the format (make sure server timezone is what you want) pm2 restart 0 –log-date-format “DD-MM-YYYY HH:MM Z”
  2. save all processes pm2 save.
  3. run these npm i -G pm2 //if not latest pm2 update.

Where is pm2 config file?

Default configuration config. js , and is located in the root folder of lisk-service : It contains a configuration to connect to a local Lisk Core node.

How do you reset pm2 service?

  1. Restart at cron time. Via CLI:
  2. Restart on file change. PM2 can automatically restart your application when a file is modified in the current directory or its subdirectories:
  3. Restart Delay.
  4. No Auto Restart.
  5. Skip Auto Restart For Specific Exit Codes.
  6. Exponential Backoff Restart Delay.

What does pm2 flush do?

pm2 flush — Flushes all log data, freeing up disk space.

Does pm2 auto restart?

PM2 will keep your application forever alive, auto-restarting across crashes and machine restarts.

How do I run pm2 JSON?

To start the defined applications within the pm2-apps. json , use the pm2 command line utility and reference the JSON file. PM2 will automatically detect each application and start them right away.

What can I See with PM2 logs?

For example, you’ll see CPU utilization, memory usage, requests/minute, and more! PM2 has built-in log management. It aggregates log data from all of your applications and writes it to a single source for viewing. You can even tail the logs in real-time to see what’s going on behind the scenes with your application.

What is PM2 and how do I use it?

PM2 allows you to easily manage your application’s logs. You can display the logs coming from all your applications in real-time, flush them, and reload them. There are also different ways to configure how PM2 will handle your logs (separated in different files, merged, with timestamp…) without modifying anything in your code.

What is PM2’s log rotation?

Log Management from PM2 comes with log rotation as well, which is important, especially if you’re application is outputting verbose logs on a frequent basis. Remember, the most important thing to do is to enable log rotation.

How many lines can the [PM2] tailing last?

[PM2] Tailing last 20 lines for [app] process Is there a way to change the limits and output it in a similar manner, but with 1000 lines, for example? Thanks for contributing an answer to Stack Overflow!