Migrating CPanel awstats from one host to another

Something little I wanted to do – I moved from a shared host to a VPS. Rather than doing the typical account backup, I had transferred the files and databases individually.

The logs were easy enough to find in the original backup – they were in:


The files are named something similar to or in the case of an addon domain, . This is important to note, because if you used a different account name on your new server, you’re going to have to RENAME these files – particularly the somename and if necessary, anothername parts. If you want to see what the new names are, browse over to your new site – as long as awstats has run (by default it only runs once every 24 hours), you should see the format of the new filenames.

Tiny sidenote: you *may* be able to get away with not renaming them to match – in that case they’d probably just “show up” as other websites in the AWStats panel – not a biggy if that’s the case, but I haven’t tested without renaming.

Anyway, to the process. Once you’ve downloaded the files to your computer (and renamed them if necessary), you’ve got to upload them to the new server. Problem is, the CPanel File Manager may not always let you put stuff in the new /home/ACCOUNT/tmp/awstats folder.

Here’s the easiest way to get around it…

  1. make a new folder of some sort in the public_html directory (“tempfilez” for example)
  2. upload the stats files in new directory you just created through cpanel’s file manager (if there are many, you may want to zip them before uploading, and then extract).
  3. log into the server through SSH (you may be able to do it as any user but I did it as root to be sure I wouldn’t have hiccups)
  4. navigate to the new folder containing the log files. In my case:
    cd  /home/ACCOUNT/public_html/tempfilez
  5. copy the files to the awstats folder. In my case:
    cp *.* /home/ACCOUNT/tmp/awstats
  6. if it asks you to overwrite any of the files, I personally said NO. Reason is that the new server started collecting stats and I didn’t want to overwrite any of the old ones. Be careful that you don’t overwrite any .CONF files if you accidently included them with the .TXT ones.
  7. navigate to the awstats log folder:
    cd /home/ACCOUNT/tmp/awstats
  8. check the permissions by using:
    ls -l
    this will list the files and tell you who the owner is. In my case the new files looked like this:
    -rw-r-r–r– 1 root root 62122 Feb 1 04:33 awstats102008.RESTOFNAME
  9. In the case above, root root means that they’re owned by root which you probably don’t want (you want them owned by the account they’re in). If that’s the case for you, you may want to change the ownership with the following command:
    Replace ACCOUNT with the name of the account. So if your account name was “fred” you’d use:
    chown fred:fred *
  10. Do another ls -l to make sure the ownership’s accurate. If it looks good, pop back into CPanel and check AWStats. If you can see information for the years/months for which they applied, you’re done!


 | Leave a Comment

    Leave a Comment

    You can use an alias and fake email. However, if you choose to use a real email, "gravatars" are supported. You can check the privacy policy for more details.

    To reduce spam, I manually approve all comments, so don't panic if your comment doesn't show up immediately.