Index

Version 18 (Simone Carletti, 02/18/2009 12:55 pm)

1 1
h1. Apache Log Analyzer 2 Feed
2 1
3 17 Simone Carletti
{{>toc}}
4 17 Simone Carletti
5 18 Simone Carletti
!>http://www.simonecarletti.com/static/images/logo/apachelog2feed.png!
6 3 Simone Carletti
ApacheLogAnalyzer2Feed is a really powerful open source PHP 5 class to parse and analyze Apache Web Server log files.
7 15 Simone Carletti
Analysis results are converted into a feed to let users subscribe them with a feed reader.
8 1
9 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.
10 1
The class can easily be extended with additional filters and custom feed handlers.
11 1
12 1
h2. A quick example
13 1
14 1
Would you like to be informed each time GoogleBot visits your website?
15 1
16 7 Simone Carletti
ApacheLogAnalyzer2Feed is the solution! ApacheLogAnalyzer2Feed will analyze server logs for you returning results in a custom feed. 
17 7 Simone Carletti
Simply using the following code fragment you'll be able to track Googlebot directly from your feed reader.
18 4 Simone Carletti
19 4 Simone Carletti
<pre><code class="php">
20 4 Simone Carletti
/**
21 4 Simone Carletti
 * @see ApacheLogAnalyzer2Feed
22 4 Simone Carletti
 */
23 4 Simone Carletti
require_once 'ApacheLogAnalyzer2Feed.php';
24 4 Simone Carletti
25 4 Simone Carletti
// Create an instance. 
26 4 Simone Carletti
// Tell the script to parse access.log file and write the results in test.xml.
27 4 Simone Carletti
$tool = new ApacheLogAnalyzer2Feed('access.log', 'test.xml');
28 4 Simone Carletti
29 4 Simone Carletti
// Add a filter to retrieve only log entries matching Googlebot useragent
30 4 Simone Carletti
$tool->addFilter('User-Agent', 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');
31 4 Simone Carletti
32 4 Simone Carletti
// Run the tool!
33 4 Simone Carletti
$tool->run();
34 8 Simone Carletti
</code></pre>
35 1
36 12 Simone Carletti
h2. Documentation and Resources
37 8 Simone Carletti
38 13 Simone Carletti
* "Downloads":/projects/list_files/apachelog2feed
39 9 Simone Carletti
* [[Installation]]
40 14 Simone Carletti
* [[Examples|Example usages]]
41 1
* [[Acknowledgments]]
42 1
43 1
h2. About this library
44 1
45 1
<img src="http://www.simonecarletti.com/blog/public/2007/05/anteprima-ses-2007/ses.png" align="right" />
46 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.
47 1
48 1
I created this project as a technical example for my speech at Search Engine Strategies 2007 in Milano, session RSS, Blogs & Search Marketing.
49 1
My goal was to demonstrate an alternative use of feeds, showing how RSS and Atom feeds can make SEO life easier.
50 16 Simone Carletti
51 16 Simone Carletti
h2. License
52 16 Simone Carletti
53 16 Simone Carletti
ApacheLogAnalyzer2Feed is available under the GNU Lesser General Public License. Visit the [[License|license page]] to learn more.