Install phpLogCon with IIS6.0

Install phpLogCon with IIS6.0

Article created 2008-10-14 by Tom Bergfeld.

In this paper, I describe how to install phpLogCon with IIS6.0. It is intentionally a brief step-by-step guide, targeted to those who want to quickly get it up and running. For more elaborate information about phpLogCon, please consult the phpLogCon manual set.

Installing IIS

If you don’t use IIS so far, you have to install it now. You just need your Windows-Installation-CD. Go to “Add or Remove Programs” in your Control Panel. There you will find IIS by clicking “Add or Remove Windows Components” (in some cases like Windows Server 2003 IIS is in “Application Server”).
Choose it and follow the install instructions.

To check if the install was correct open your browser and type “localhost” in your navigation bar. You should see the following screen (it’s the default startscreen of the IIS).

Downloading PHP-installer

Here you will find the PHP installer. Download it and follow the instructions of the installer. A simple test should show if the install was correct. Create a simple test.php-file in your webbrowser folder (default IIS folder c:\Inetpub\wwwroot) and try to open it via your browser. I created a simple test.php for you, that you can use to test your PHP by clicking here or download it.

Downloading phpLogCon

For obvious reasons, you need to download phpLogCon.
Load the most recent build from here.

Installing phpLogCon

Perhaps you will need to download and install third party software like WinRAR to unpack the downloaded phpLogCon tar.gz file.

Open the windows explorer and go to the Inetpub\wwwroot folder of your IIS web server, which is the folder where you can place html/php files. Create a new folder called phplogcon there.

If you downloaded and unpacked phpLogCon, copy or move the content of the src folder into the C:\Inetpub\wwwroot\phplogcon folder.

The explorer window should be like in the screenshot now.

Before you can start the real install you have to set write permissions in the settings of the IIS like in the screenshot. Right click on the wwwroot folder -> properties -> security

Now open your phplogcon installation in your favourite webbrowser (localhost/phplogcon), you will see an error, and you will be pointed to the installation script. The install script will guide you through the phplogcon installation, just follow the instructions.

In the first step phpLogCon creates the config.php file in your created phplogcon folder and checks the permissions, if the config.php can be written or not.

In the next steps you can set several basic options.

Number of syslog messages per page = 50 (default)
This is the number of syslog messages displayed on each page. You can increase the value (makes phpLogCon slower) or decrease the value (makes it faster).

Message character limit for the main view = 80 (default)
Set the number of characters per message which will be shown in the last column of the main view. Full messages can be reviewed by hovering the mouse over it.

Show message details popup (default yes) = yes (default)
Here you can set, if you want the small window with the complete message to pop up if you are hovering over a event with the cursor. If you choose “No”, then you have to click on the message to see the details.

Create the first source for syslog messages.
Step 7 is the most important. Here, you will configure your first data source, which holds all your syslog data. Mainly, you have to choose a “Name of the Source” and a “Source Type”. The name will be displayed later in a drop-down menu with which you choose your active syslog source. The “Source Type” can be a file, a MySQL database or the PHP PDO which supports different database types like mssql, PostgreSQL, odbc, oracle or even ibm db2.

If you choose the diskfile,like in our case, you have to provide the following information:
Logline Type = Syslog / Rsyslog (default) or Adiscon WinSyslog
This tells phpLogCon, how the lines look like. This is necessary for showing the log messages properly.

Syslog File = /var/log/syslog (default)
This is the position of the logfile in your file system.
The only thing we have to change is the Syslog File into the folder of your choice. I created a file called Webserver.log in the folder c:\Logs, therefore my screen looks like this.

You are done!

In the next step you finish your install. The last thing you have to do is to delete or rename your install.php in your
c:\Inetpub\wwwroot\phplogcon folder to avoid a reinstall everytime you start your phpLogCon.

How to setup File logging in MonitorWare Agent to consolidate Webserver logs and view them in phpLogCon

How to setup File logging in MonitorWare Agent to consolidate Webserver logs and view them in phpLogCon.

Article created 2008-10-05 by Andre Lorbach.

This article will help you to setup an environment where you can store weblogs from your webserver at a central place using MonitorWare Agent, and view and search them using phpLogCon.

You can download a preconfigured configuration from this link and import that into your own system. The configuration sample contains comments for better understanding. MonitorWare Agent Client can import the XML/REG configuration file via the “Computer Menu”.

Table of Contents

1. Requirements
1.1 About the requirements
1.2 Installing and configuring WAMP
1.3 Installing MYSQL ODBC Connector
2. Installing and configuring MonitorWare Agent
2.1 Download and Install MonitorWare Agent
2.2 Setup Processing RuleSet
2.2.1 Setup Database Logging
2.2.2 Create the Database Action in MonitorWare Agent
2.3.1 Setup File Logging
2.4 Add File Monitor Service(s)
2.5 Starting MonitorWare Agent and verifying the configuration
3. Install and Setup phpLogCon
3.1 Download and copy phpLogCon to the right location
3.2 Install and configure phpLogCon
Final Thoughts

1. Requirements

1.1 About the requirements

If you already have a web server with PHP support and MYSQL Server running, you can skip step 1.1 and 1.2.

This can be done with Internet Information Server, but this article focuses on using Apache to do the job. There is another article underway which describes IIS.

So in order to setup phpLogCon later, you will need a web server with PHP support and a MYSQL Server with an administration interface. For these tasks, we recommend the following open source applications:

You can install and configure all these applications separately, but it is much easier to get WAMP for Windows. WAMP means Apache, MYSQL, PHP on Windows and combines all applications with a default configuration. This results in a system which can be used out of the box. So you do not need to worry about the Apache or MYSQL configuration, you just install WAMP first.

Download the latest WAMP Version from here:
http://www.en.wampserver.com/

Back to Top

1.2 Installing and configuring WAMP

After you downloaded WAMP, start the installation and follow the instructions.
Make sure you do not have a web server or MYSQL Server already installed because this could result in conflicts. Most often Microsoft ISS is already installed on the Windows platform. If so, there is no need to install WAMP, but you still need MySQL and php for IIS. This is described in another guide.

I will use the default installation location in this article which is C:\wamp.

Back to Top

Once the Installation is finished, a new Icon appears in Windows Icon tray. Click it, and choose “Localhost” from the menu to verify if the installation was performed successfully. If it was, you should see a web site looking like the one on the right.

To check if your MYSQL is running, click on the phpMyAdmin Menu button in the WAMP Menu, and login with the username “root” and no password – if you are asked for a login.

Back to Top

1.3 Installing MYSQL ODBC Connector

If you intend to store messages in MYSQL database, you need to install the MYSQL ODBC Connector. Otherwise you can skip this step.

MonitorWare Agent will need a MYSQL ODBC driver in a later step in order to write into the MYSQL database. These drivers have to be downloaded and installed separately from here:
http://dev.mysql.com/downloads/connector

If your Windows System is a x64 version, it is important to install the x64 Version of the MySQL Connector driver. As the WinSyslog Service runs as a 64bit application itself, it will need the connector to be 64bit as well.

2. Installing and configuring MonitorWare Agent

2.1 Download and Install MonitorWare Agent

So if you have not done so already, go to www.mwagent.com and download the latest MonitorWare Agent Version. It is always recommended to use the latest Version of MonitorWare Agent. Once the download has completed, go ahead and install it. Depending on your system, a system restart may be needed (but it usually is not)

2.2 Setup Processing RuleSet

Start MonitorWare Agent Client, and skip the First Startup Wizard.

Add a new RuleSet and call it “Store Logdata”.

Back to Top

2.2.1 Setup Database Logging

If you want to store messages inside MYSQL, follow this step.

Click on your WAMP Icon, and open the phpMyAdmin. Now Create a new database called “mwagent”.

Back to Top

Once done, select the newly created database, switch to the “SQL” tab and copy the SQL statements from the textbox below.

Now insert the copied commands into the SQL field. Then Click “GO”, you should see “Your SQL query has been executed successfully” after that as well as two new tables on the left list called systemevents and systemeventsproperties.

Back to Top

2.2.2 Create the Database Action in MonitorWare Agent

Get back to the MonitorWare Agent Client and create a new Rule in your self-created RuleSet called “Database”. Then add a new “Write to Database” Action, and name it “MYSQL ODBC”. After creating this action, you should automatically be taken to the actions properties.

Click on the “Data Sources (ODBC)” button to open the System ODBC Administrator. Click on the “System DSN” Tab and add a new Datasource, select “MySQL ODBC 5.1 Driver” as driver. It is important to add a System DSN rather then a User DSN, because User DSN’s are not usable by the MonitorWare Agent Service (this is a Windows design restriction).

Name the new datasource “mwagent” and use “localhost” as Server, “root” as username and no password. Then you are able to select the database which we created before called “mwagent”.

Back to Top

Check the database logging action again, it should look like the one in the screenshot.

Back to Top

2.3.1 Setup File Logging

If you want to consolidate your webserver logfiles in one large logfile, proceed with this step. Otherwise you can skip this step.

  • Create a new rule called “File Logging” and add a “Write to File” Action.
  • Select Custom Line Format, use the following (use copy&paste to enter it):
Back to Top

Back to Top

2.4 Add File Monitor Service(s)

First of all find the exact location of the webserver logfiles you want to monitor. In this example, I use the access.log from my local wamp installation located at C:\wamp\logs.

Back to Top

Now add a file monitor service. Inside that service, configure the correct file and path name of the file to be monitored. If you would like to read multiple files, you can enable the property replacer inside the filename.

Be sure to specify the log file type to “W3C WebServer Logfile”. This is important so that the contents can properly be interpreted.

It may also be a good idea to set a syslog tag name that matches the filename (or the function of the file name, e.g. “online-shop”). By doing so, you can easily filter inside phpLogCon.

Back to Top

Back to Top

2.5 Starting MonitorWare Agent and verifying the configuration

From the MonitorWare Agent configuration point of view, everything is setup now. So kindly start the MonitorWare Agent Service and wait a few moments, so that the data can be processed.

If you are using file logging, you should see that the logs folder on C:\ has been created and contains a WebServer.log file. If not, something went wrong. In this case please check the Windows Application EventLog for possible error reports from MonitorWare Agent.

Back to Top

If you are logging into a database, switch back to phpMyAdmin and browse through the systemevents table. You should see at least one data record in this table now, like in the screenshot sample. If not, something went wrong, in this case please check the Windows Application Event Log for possible error reports from MonitorWare Agent.

Back to Top

3. Install and Setup phpLogCon

3.1 Download and copy phpLogCon to the right location

If you are using MonitorWare Agent 8.3 or higher, a proper version of phpLogCon can be found in the MonitorWare Agent installation folder. If you are using an older Version of MonitorWare Agent, I recommend to download the latest stable or beta build from here: http://www.phplogcon.org/downloads
In this article I will use phpLogCon Version 2.5.13.

To unpack the install set, you need a program capable of processing tar.gz files. Most ZIP programs support this. If you do not have one, you can find WinRAR by following the link (we have no affiliation with the makers of WinRAR, but have found it to be a useful tool – use at your own risk).

Open windows explorer and go to the www folder of your Apache web server, which is the folder where you can place html/php files. By default this will be “C:\wamp\www” if you have installed WAMP into the default installation folder. Create a new folder called phplogcon there.

If you downloaded and unpacked phpLogCon, and copy or move the content of the src folder into the C:\wamp\www\phplogcon folder. If you have MonitorWare 8.3 or higher, you can use and copy the contents of the phpLogCon folder of your MonitorWare installation.

The explorer window should look like in the screenshot now.

Back to Top

3.2 Install and configure phpLogCon

Open this link to start the phpLogCon installation: http://localhost/phplogcon/

If you do not see a page like in the screenshot, something went wrong in the steps before, please check them in this case.

Otherwise click on the text-link “here” on phpLogCon’s error page to start its installation routine.

Back to Top
Follow the installation steps of phpLogCon.

I recommend to “Enable User Database” in Step 3, as this will give you an advanced admin control panel. The User Database requires a MYSQL database to work, you can use the same one as you are using for MonitorWare Agent.

Back to Top
If you are using MYSQL to store log messages and you have reached Step 7, switch the source type to “MYSQL Native” and name the Source “WebLogStore DB” Use “mwagent” as Database Name and “root” as Database User. Leave the other configuration variables as they are, see the screenshot for how it should look like. Then click on the Next button to finish the installation.
After you finished the Installation of phpLogCon, you need to login and switch to the sources admin and configure the source “WebLogStore DB” there.

– In field “Message Parsers” add apache2 if you are using combined log format. Add apach2common if you are using common log format.

Back to Top
If you are using file logging and you have reached Strep 7, switch the source type to “Diskfile” and name the Source “WebLogStore FILE” Use “C:/logs/WebServer.log” as syslog file. Leave the other configuration variables as they are, see the screenshot for how it should look like. Then click on the Next button to finish the installation.
After you finished the Installation of phpLogCon, you need to login and switch to the sources admin and configure the source “WebLogStore FILE” there.

– In field “Message Parsers” add apache2 if you are using combined log format. Add apach2common if you are using common log format.

Back to Top
After clicking on the “Finish” link, you should see a working phpLogCon installation. If you do not see any data, there may be no data in your database yet. Otherwise you will see an error code and message from phpLogCon.

Back to Top

Final Thoughts

I hope this article will help you installing and configuring phpLogCon and MonitorWare Agent. If you have problems or question related to this article, don’t hesitate to contact me or our support by email.

Please note that while this setup works, it is not very secure. At a minimum, it is recommended to set proper passwords for the databases (instead of using a password-less root account). Please review the relevant documentation on how to do that.