Index
Version 5 (Simone Carletti, 08/26/2008 02:33 pm)
| 1 | 1 | h1. Apache Log Analyzer 2 Feed |
|
|---|---|---|---|
| 2 | 1 | ||
| 3 | 1 | <img src="http://www.simonecarletti.com/static/images/logo/apachelog2feed.png" align="left" /> |
|
| 4 | 3 | Simone Carletti | ApacheLogAnalyzer2Feed is a really powerful open source PHP 5 class to parse and analyze Apache Web Server log files. |
| 5 | 1 | Analysis results are converted into a feed to let users subscribe with a feed reader. |
|
| 6 | 1 | ||
| 7 | 1 | You can define custom filters based on logs data — for instance User-Agent, IP, requested page... — and combine them to select just a limited resultset. |
|
| 8 | 1 | The class can easily be extended with additional filters and custom feed handlers. |
|
| 9 | 1 | ||
| 10 | 1 | h2. A quick example |
|
| 11 | 1 | ||
| 12 | 1 | Would you like to be informed each time GoogleBot visits your website? |
|
| 13 | 1 | ||
| 14 | 5 | Simone Carletti | ApacheLogAnalyzer2Feed is the solution! ApacheLogAnalyzer2Feed will analyze server logs for you returning results in a custom feed. You'll be able to track Googlebot directly from your feed reader. |
| 15 | 4 | Simone Carletti | |
| 16 | 4 | Simone Carletti | <pre><code class="php"> |
| 17 | 4 | Simone Carletti | /** |
| 18 | 4 | Simone Carletti | * @see ApacheLogAnalyzer2Feed |
| 19 | 4 | Simone Carletti | */ |
| 20 | 4 | Simone Carletti | require_once 'ApacheLogAnalyzer2Feed.php'; |
| 21 | 4 | Simone Carletti | |
| 22 | 4 | Simone Carletti | // Create an instance. |
| 23 | 4 | Simone Carletti | // Tell the script to parse access.log file and write the results in test.xml. |
| 24 | 4 | Simone Carletti | $tool = new ApacheLogAnalyzer2Feed('access.log', 'test.xml'); |
| 25 | 4 | Simone Carletti | |
| 26 | 4 | Simone Carletti | // Add a filter to retrieve only log entries matching Googlebot useragent |
| 27 | 4 | Simone Carletti | $tool->addFilter('User-Agent', 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'); |
| 28 | 4 | Simone Carletti | |
| 29 | 4 | Simone Carletti | // Run the tool! |
| 30 | 4 | Simone Carletti | $tool->run(); |
| 31 | 4 | Simone Carletti | </code></pre> |
| 32 | 4 | Simone Carletti | |
| 33 | 1 | ||
| 34 | 1 | h2. About this library |
|
| 35 | 1 | ||
| 36 | 1 | <img src="http://www.simonecarletti.com/blog/public/2007/05/anteprima-ses-2007/ses.png" align="right" /> |
|
| 37 | 1 | ApacheLogAnalyzer2Feed is an easy-to-use object oriented class, written in PHP 5, for parsing/filtering an Apache log file and consuming the results with a feed reader. |
|
| 38 | 1 | ||
| 39 | 1 | I created this project as a technical example for my speech at Search Engine Strategies 2007 in Milano, session RSS, Blogs & Search Marketing. |
|
| 40 | 1 | My goal was to demonstrate an alternative use of feeds, showing how RSS and Atom feeds can make SEO life easier. |