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 awstats012007.somename.com.txt or in the case of an addon domain, awstats012007.anothername.somename.com.txt . 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…
- make a new folder of some sort in the public_html directory (“tempfilez” for example)
- 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).
- 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)
- navigate to the new folder containing the log files. In my case:
- copy the files to the awstats folder. In my case:
cp *.* /home/ACCOUNT/tmp/awstats
- 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.
- navigate to the awstats log folder:
- check the permissions by using:
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
- 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:
chown ACCOUNT:ACCOUNT *
Replace ACCOUNT with the name of the account. So if your account name was “fred” you’d use:
chown fred:fred *
- 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!