tr4nc3 Posted February 27, 2004 Share Posted February 27, 2004 I read in another thread that the fullpath to access raw logs is at... /usr/local/apache/domlogs/****** 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. Help? Quote Link to comment Share on other sites More sharing options...
MikeJ Posted February 27, 2004 Share Posted February 27, 2004 You can only access the domain log of the account you are trying to access it with. Quote Link to comment Share on other sites More sharing options...
borfast Posted February 27, 2004 Share Posted February 27, 2004 Mike, are you sure about that? I tried it myself on my personal account and I couldn't read it either :\ Quote Link to comment Share on other sites More sharing options...
MikeJ Posted February 27, 2004 Share Posted February 27, 2004 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. Quote Link to comment Share on other sites More sharing options...
borfast Posted February 27, 2004 Share Posted February 27, 2004 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? http://www.suphp.org/ I don't think so but I thought I'd ask Quote Link to comment Share on other sites More sharing options...
MikeJ Posted February 27, 2004 Share Posted February 27, 2004 Dust off those perl skills! Quote Link to comment Share on other sites More sharing options...
borfast Posted February 27, 2004 Share Posted February 27, 2004 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... Quote Link to comment Share on other sites More sharing options...
MikeJ Posted February 27, 2004 Share Posted February 27, 2004 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. Quote Link to comment Share on other sites More sharing options...
tr4nc3 Posted March 3, 2004 Author Share Posted March 3, 2004 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: ftp://USERNAME_logs:PASSWORD@ftp.YOURDOMA.../YOURDOMAIN.TLD 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.