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 15.0k 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

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

      1 Reply Last reply Reply Quote 0
      • KirAsh4K Offline
        KirAsh4 Moderator
        last edited by

        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

          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

            This post is deleted!
            O 1 Reply Last reply Reply Quote 0
            • O Offline
              Ogden62 @Ogden62
              last edited by

              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