Customisation tutorial : Custom Default paths for Virtualmin / Webmin or other software

inepuisable's Avatar


30 Apr, 2019 04:48 PM

Using this wonderful piece of code for a while (many Thanks to devs and potsky ).
I use Virtualmin / Webmin and the creation of users / virtual hosts is is done in /home folder due to suexec that is compiled that way on most of Linux official distros.
So the logs are in the form of /home/new_user/folder_with_logs or /home/new_user/public_html/folder_with_logs .
Since I use Skeleton to get a fresh auto-upgrade PML from another folder, I create the apache.paths.user.php in /cfg file where I put the specific dynamic path to the logs that are searched upon first install :

Take the apache.paths.php and make a copy named apache.paths.user.php. Search around line 13 for " $paths = " and remplace or add this variable with the following content (to be edited as you need) :

 * All possible paths where log files could be found
 * @var  array

/* Custom path for Virtualmin Skeleton */

//Get the current script path with PHP or use  use PML_BASE constant 

$base_path_transform = __DIR__; 

// Create an array from the base path to recover the user, in this case is the third entry starting from 0.
$user = explode("/",$base_path_transform); 

// Transform the path that you found and search & replace (some Regex magic come along) with the one you need, here /home/JohnSnow/logs/ if the user is JohnSnow :)

$custom_path = strtolower(preg_replace('&\/home\/' . $user[2]. '/public_html[\W\s\/]+PimpMyLog(.*)&', '/home/' . $user[2]. '/logs/', $base_path_transform));

$paths = array(

Now, put the apache.paths.user.php that is protected from updates in your Skeleton folder, and the newly copies of your beloved PML are ready to be use with your custom paths already chosen by default.
Same method can be used to generate a config file each time a new virtual server is created, but with the help of some python code since the user / password need to be taken from unix / mysql other locations for new users.

Here is my little contribution, hope you find it useful, have a great logging session !

Tags : Virtualmin / Webmin Custom Path Log PimpMyLog

  1. inepuisable closed this discussion on 30 Apr, 2019 04:48 PM.

  2. inepuisable re-opened this discussion on 30 Apr, 2019 05:08 PM

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac