1 - Introduction

You can add new softwares in Pimp My Log for all Pimp My Log users.

The first default included software is apache.

When we will add some softwares, users will have to choose which softwares they want during the configuration part at the first launch.

2 - Configuration process

At first launch, Pimp My Log will launch the configurator and will :

3 - Build a configurator

3.1 - Write your configuration file

Before all, you should manually create your configuration file to support the new software.

Once you have written the RegEx, match and types arrays, save your configuration file somewhere on your hard-drive, we will need it later. Read the documentation menu and all other developer menus to do this.

3.2 - Enhance your software list

To add a new software, create your own enhanced software list. It will define your new software. Don't modify directly cfg/softwares.inc.php, you will not be able to update Pimp My Log during you development phase and you could lose your work!

Copy cfg/softwares.inc.php to cfg/softwares.inc.user.php.

Note

File cfg/softwares.inc.user.php is not overwritten while updating Pimp My Log via a git pull.

Edit cfg/softwares.inc.user.php :

You should have something like this:

<?php
$softwares_all[ 'my_software' ] = array(
    'name'  => __('My Super Software'),
    'desc'  => __('My Super Software build with love for you users which are installing Pimp my Log !'),
    'home'  => __('http://www.example.com'),
    'notes' => __('All versions 2.x are supported but 1.x too in fact.'),
    'load'  => true,
);
?>

Change wanted values:

Now, if you remove your configuration file config.user.json to start a new Pimp My Log instance, Pimp My Log will ask you which softwares to install. Nice!

3.3 - Add your software common paths

Now that you have declared a new software, you have to explain to Pimp My Log where it can check for new log files for your software.

Theses paths have to be declared in a file named cfg/ID.paths.user.php where ID is the value of my_software in the paragraph above.

Note

File ID.paths.user.php is not overwritten while updating Pimp My Log via a git pull.

Take this example:

<?php

$paths = array(
    '/var/log/',
    '/var/log/apache/',
    'C:/wamp/logs/',
);

$files = array(
    'error' => array(
        'error.log',
        'error_log',
    ),
    'access' => array(
        'access.log',
        'access_log',
    ),
);
?>

You must define both arrays:

In the example above, Pimp My Log will check for 2 types of log files :

Note
Even if your software just uses a single type of log file, $files has to be an array of array.

3.4 - Add your software configurator

Finally, you have to create a function which will return the JSON configuration part for a single log file.

This generator function has to be created in a file name named cfg/ID.config.user.php.

This function has to be named ID_get_config( $type , $file , $software , $counter )

With the same example:

 1 <?php
 2 function ID_get_config( $type , $file , $software , $counter ) {
 3     if ( $type == 'error' ) {
 4         return<<<EOF
 5             "$software$counter": {
 6                 "display" : "Apache Error #$counter",
 7                 "path"    : "$file",
 8                 ...
 9                 "format"  : {
10                     "regex": "|^\\\\[(.*) (.*) (.*) (.*):(.*):(.*)\\\\.(.*) (.*)\\\\] \\\\[(.*):(.*)\\\\] \\\\[pid (.*)\\\\] .*\\\\[client (.*):(.*)\\\\] (.*)(, referer: (.*))*\$|U",
11                     "match": { ... },
12                     "types": { ... },
13                     "exclude": { ... }
14                 }
15             }
16 EOF;
17     }
18     else if ( $type == 'access' ) {
19         return ...;
20     }
21 ?>

Here are some explanations:

4 - Delivery

You can make a GitHub Pull Request on the dev branch only or send us your files via a discussion in the support website.

Then we will: