Jump to content

Recommended Posts

I read in another thread that the fullpath to access raw logs is at...




I get 'Permission denied' when trying to access the file. I know it exists there to because if I change one character of the domain name I get a 'file doesn't exist' error.


I'm trying to make a bandwidth monitoring script so that I can keep track of bandwidth of 20 (maybe 20 times 10 in a week or two) websites.


I've tried using the built in functions of WHM to access the bandwidth quote, no avail. I've thought about parsing pages from WHM, but that's just idiotic. I also thought about just guessing on a per-hit basis. (Which it seems like I'm going to have to do here soon because there seems to be NO WAY for my scripts/applications to gather bandwidth information for my resold accounts.



Link to post
Share on other sites

Are you trying to access the log file as your user, or are you trying to access it via a web script (which would not be running as your user account)?


If you want to access the log via a web script, you'd have to run it as a SecureCGI. Otherwise, you should do it as cron, probably.


I'm only as sure as how cPanel writes it by default, which is group owned by the account (with read priviliges only), and world has no privileges. I'm not on a shared server so I can't try it for myself to see if TCH has done anything differently.

Link to post
Share on other sites

Never mind that, I'm trying to access it via a script, which is runnning as the Apache user.

This is one thing that really annoys me about PHP scripts: you can't make them execute as your user! Mad!!! :)


Bill, have you ever considered this?



I don't think so but I thought I'd ask :(

Link to post
Share on other sites

Mike, what perl skills? :) :(


Never knew how to program in perl in the first place. Not sure why but I have always looked at perl as a strange and heavy "thing". Heavy in the sense that it's heavy for the webserver.


I guess I should try to learn it, though...

Link to post
Share on other sites

Yea, it's a little more resource intensive, especially without mod_perl. I use perl almost entirely for commandline and cron type stuff, not so much for web... but for processing logs it wouldn't be so bad, other than the fact you'd have to learn it.

Link to post
Share on other sites

Actually guys... You can forget about having to use PERL for this. You got me all bummed out thinking I wasn't going to be able to get this done!


You can only access the domain log of the account you are trying to access it with.


You can access anybodies logs from anywhere. (As long as you have their UN & PW)


Just ftp to:




I needed a script that would, as you know, that would keep my database updated with the 'Bandwidth usage' of all of my resold accounts. (So I didn't have to try and make sense out of Cpanel's usage chart.)


FYI, this is how I do it...


A PHP script, triggered by a CRON @ 12:01 AM everyday..


FTP to the location where you can pickup your logs, download the LOG, strip the log of all lines that are not from yesterday, parse the log and get the bytes transfered, delete the downloaded file, update my DB with the new bandwidth total, and restart the loop for every domain in the DB.


Works like a charm!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...