REQ: Rotate the log files

Discussion in 'Installation and Configuration' started by Smudge2, Apr 25, 2011.

  1. Smudge2

    Smudge2

    Messages:
    37
    Parallels keeps a fairly detailed log file which can grow very large. Personally I've only seen it grow to just over 1GB but this user has his over 12GB. That is just unnecessary.

    There are multiple log files being kept. Each VM has one within the VM package container. There there is another parallels.log for the application. Mine is currently in /Library/Logs/ but I also found an older one in my ~/Library/Logs/ directory.

    I understand the need for a debug log so I wouldn't want it to go away but can you please rotate it, perhaps at every application launch?

    May I suggest that you follow the pattern the OSX system logs use by issuing calls to the newsyslog program. It has the ability to rotate log files based on size, time, or forced when called. It will bzip2 compress the rotated logs as well. (FYI, the Console program can natively read bz2 logs without decompressing so they can still be read if needed). You can tell it how many archives logs you wish to keep.

    Normally you would call it with a newsyslog.conf file argument but it is also possible to call it passing in the config options as STDIN like so.

    echo "/Library/Logs/parallels.log 644 5 * * JN" | newsyslog -srF -f -

    I use this in a system startup script to rotate the logs at each system boot. It would be possible for someone to add the config to the default system newsyslog.conf config file and have it rotate the logs based on time or log size. I've tested it and Parallels seems to be ok with it and continues writing to the new log file. Since Parallels isn't written with log rotation support, I'm not sure if it would handle the log file being moved when it tried to write to it which is why I have it configured to do it at the system boot.

    It would be a lot nicer if Parallels took care of it's own log files though.

    Thanks for your consideration.

    EDIT/FOLLOWUP: So I've been thinking of moving this to a proper newsyslog conf file. If I were to do so, I would just create a new file of /etc/newsyslog.d/parallels.conf containing entries for the primary app log file and each VM's log file, like this.

    Code:
    # logfilename                                          [owner:group]    mode count size    when    flags [/pid_file] [sig_num]
    /Library/Logs/parallels.log                             smudge:admin    600  5     5000    *       JN
    /Win7.pvm/parallels.log                                 smudge:staff    600  5     5000    *       JN
    /Users/smudge/Documents/Parallels/XP.pvm/parallels.log  smudge:staff    600  5     5000    *       JN

    However, as I mentioned above, I didn't notice anything bad about rotating out the log while the VM/application is running but the proper way is to notify the daemon/service that is logging usually with a SIG command.
    So which is the proper process to notify of the log rotation and what SIG number should be used? There seems to be multiple processes accessing the log files (WinAppHelper, prl_disp_service, prl_client_app to the main log; prl_vm_app also to the VM log) but only the prl_disp_service had a .pid file I could point to.
     
    Last edited: Apr 25, 2011
  2. JuliaU

    JuliaU

    Messages:
    23
    Hi, Smudge2,

    Are you sure that you do not have "Use detailed log messages" checked in Parallels Desktop preferences -> Advanced? It looks like it. Parallels Desktop actually rotates logs and the size of logs is usually no more then several megabytes and contains only the latest data. For example, I checked on my machine:

    /Library/Logs/parallels.log - 1.4 MB
    /.pvm/parallels.log - 9.3 MB
     
  3. Smudge2

    Smudge2

    Messages:
    37
    Nope. I don't have the detailed log option enabled but my log goes back over 1.5 years.
     
  4. Win Crasher

    Win Crasher

    Messages:
    4
    Yeah, this just shut down my server. I posted another request too. Did you get any love on this? Not looking like it..
     
  5. Smudge2

    Smudge2

    Messages:
    37
    Obviously no response from them in this thread. I haven't tried the latest release (6.0.12090.660720) as the new features don't appeal to me ("Post about your exploring Windows on the Mac to Twitter and Facebook right from Parallels Desktop" - Seriously?) but perhaps in the "Many issues have been fixed" reference, this problem was addressed.

    I created the newsyslog.d/parallels.conf file as I detailed above and that has worked great. That daemon properly rotates the log files for me and I don't have the space issues any more. Since you are having the same problem, I would recommend you read up on newsyslog.d and create a config file for your log files.
     
  6. Win Crasher

    Win Crasher

    Messages:
    4
    I'm going to try the pay for email response, will see what happens...
     

Share This Page