PDA

View Full Version : Apache Log Viewer


Trigunflame
02-10-2006, 10:00 PM
[CENTER]Apache Log Viewer
View Live Access

Summary:

Simply allows you to view apache log statistics for your desired logfile. Shows IP Addresses, Requests for that IP, and Last Request ordered by Total Requests.

It is compatible with Apaches common, and combined default log formats; other than that its up to you to make the modifications to suit your needs, if you need help just reply back here with the logformat that you use and we can add it as an option for other people.

Also to note, depending on the log file size it may take a good bit of memory to parse the logfile, although there is an option to set how many lines the script should parse before ending.

Note: You probably should set the path to Your domains logfile wherever that may be, as the global apache logfile is probably huge.


Installation:

Download Zip File, Extract..
Open apache_logs.php and edit these 2 settings:
define('LOG_FILE_NAME', 'c:\apache\logs\common.log');
define('LOG_FILE_LINES', 5000);
Place apache_logs.php in your admincp folder
Place cpnav_apache_logs.xml in your includes/xml/ folder
Import the product-apache_logs.xml as a product
Click the View Apache Logs link in your admincp navbar.


Changes:
Moved the feof loop outside of the fscanf to prevent termination of non-matching lines.

Zia
02-11-2006, 07:07 AM
Yahoooooooooo

1st post 1st post

Zia
02-11-2006, 07:10 AM
Now....gonna trying it...

tho dont what it will do.........& what benifit i wll get from it :D

DeMiNe0
02-11-2006, 07:23 AM
For the most part a hack like this isn't good if your using shared hosting. Most of the time the shared hosts block access to the apache logs.

Marco van Herwaarden
02-11-2006, 07:44 AM
Not if they set things up so that each hosting client has it's own logs.

Trigunflame
02-11-2006, 08:46 AM
Not if they set things up so that each hosting client has it's own logs.
< Nods, most hosts use cpanel which generally use domlogs that contain individual logs for each domain.

Omranic
02-11-2006, 10:08 AM
nice

but how Do I now the location & the path of the file common.log ?

Trigunflame
02-11-2006, 10:17 AM
nice

but how Do I now the location & the path of the file common.log ?

This simple hack is generally for the technically inclined :), but the logs can be any place; if you dont know the exact path to your logs try asking your webhost where you can find it.

If you use cpanel, you should have access to a log page that will tell you the location of the logs for your site.

Trigunflame
02-11-2006, 06:44 PM
Changed:
Moved feof loop outside of the fscanf to prevent termination of non-matching lines.

Guest210212002
02-11-2006, 08:20 PM
This work with linux? I don't have a common.log on my server.

Trigunflame
02-11-2006, 08:34 PM
This work with linux? I don't have a common.log on my server.

Yes, you just have to point the script to your Domains logs wherever that may be.

Most apache log formats are common or combined whether they are named such or not.

Snake
02-12-2006, 09:18 AM
w00t w00t

* Aftermath clicks on install

Symen_4ab
02-12-2006, 03:25 PM
Great idea, I hate when I have to go through ssh + vi to read my logs ;)

Tried to install it, but.. My log is located at /usr/local/apache/domlogs/mydomain.com
So, i the configuration line looks like this :


define('LOG_FILE_NAME', '/usr/local/apache/domlogs/mydomain.com');


Doesn't work.. Could not open log file.

Any advice ?

Marco van Herwaarden
02-12-2006, 04:13 PM
Are you sure that is the logfilename, and not only the directory in which the file is located?

Symen_4ab
02-12-2006, 04:36 PM
Yes, I'm sure about this, I can vi it.
I'll try with relative path in a few minutes


edit : Did try some things and achieved to finally understand..

I removed the @ in front of the fopen function, showing me the error returned.
When using the correct path : Warning: fopen(/usr/local/apache/domlogs/domain.com): failed to open stream: Permission denied in /admincp/apache_logs.php on line 39 :)
Got it working by chmodding the logfile (is 555 right ?)

Marco van Herwaarden
02-12-2006, 04:56 PM
Got it working by chmodding the logfile (is 555 right ?)
Better use 644. If you use 555 your webserver also can not write to it anymore.

Symen_4ab
02-12-2006, 05:05 PM
Thanks Marco, just changed it ;)

Trigunflame
02-12-2006, 10:40 PM
Updated

Trigunflame
02-27-2006, 02:17 AM
bump.. for the hell of it (GET A HACK DB MADE ALREADY).

Trigunflame
03-15-2006, 07:35 PM
Vote Vbulletin World Map System OR Plugin Accelerator for HOTM (https://vborg.vbsupport.ru/showthread.php?p=926146)

Hornstar
05-06-2006, 11:30 AM
If im getting dossed, will it show the ip address of the user who is over loading the server? Or which logs should i be viewing?