• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Flushing pm2 logs

Scheduled Pinned Locked Moved Core System
6 Posts 4 Posters 14.8k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    CGabo
    last edited by Jun 7, 2016, 9:55 PM

    Automatically log rotate all applications logs managed by PM2
    https://github.com/pm2-hive/pm2-logrotate

    1 Reply Last reply Reply Quote 0
    • K Offline
      KirAsh4 Moderator
      last edited by Jun 7, 2016, 10:01 PM

      Yes that’s another option, however personally I don’t use log rotates for a variety of reasons. In this case specifically, others have mentioned problems with it on the PM2 site.

      A Life? Cool! Where can I download one of those from?

      1 Reply Last reply Reply Quote 0
      • E Offline
        E3V3A
        last edited by Mar 14, 2018, 6:23 AM

        I just want to add, that using pm2 flush in a script (for restart purposes) may not work as expected. The next operation will start immediately, before flush completes, and thus the new thread will already start writing to the file, blocking it from getting cleared.

        You need to wait for the entire thread to finish, like this:

        pm2 flush; pm2 start mm; echo "this doesn't clear the logs";
        
        pm2 flush &&  pm2 start mm; echo "now it works";
        

        "Everything I do (here) is for free – altruism is the way!"
        MMM-FlightsAbove, MMM-Tabulator, MMM-Assistant (co-maintainer)

        1 Reply Last reply Reply Quote 1
        • O Offline
          Ogden62
          last edited by Apr 19, 2021, 9:54 AM

          This post is deleted!
          O 1 Reply Last reply Apr 19, 2021, 12:22 PM Reply Quote 0
          • O Offline
            Ogden62 @Ogden62
            last edited by Apr 19, 2021, 12:22 PM

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy