1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

How Do I Create Custom Log Formats in Plesk 7.5.3

Discussion in 'Plesk for Linux - 8.x and Older' started by synergypoint, Jun 1, 2005.

  1. synergypoint

    synergypoint Guest

    I need to basically override the default log format settings in Plesk for an individual domain.

    I need to do this in order to use Urchin's UTM module which requires that cookies are included in each log entry.

    In the past I simply modified the main httpd.conf file but in Plesk 7.5.3 that doesn't work any longer. The log files are defined in the httpd.include file for each domain.

    I can add an entry into the vhost.conf file for the domain but that either creates duplicate log entries (if I specify the default log file) or requires that I create a seperate log file, in which case I end up with 2 log files.

    I want to do this while still having access to Plesk's reports AND to be able to use the log rotation service built into Plesk.

    Is this possible and how?

  2. neuromancer

    neuromancer Guest

    I've started moving some of my existing clients on to Plesk and have the same requirement. Rather than trying to specify the cookie setting at the individual vhost level, I suggest setting it as the default format in the httpd.include:

    Where you find the line

    DocumentRoot /home/httpd/vhosts/default/htdocs

    <IfModule mod_logio.c>
    LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" \"%{Cookie}i\"" plesklog
    <IfModule !mod_logio.c>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Cookie}i\"" plesklog

    With this config, sites that don't use UTM will just register blank entries for that column. You won't end up with two log files and Plesk stats shouldn't be affected.
  3. synergypoint

    synergypoint Guest

    I thought of that originally and I can't remember why I didn't go that way.

    Doesn't this file get re-written each time a change is made in plesk or each time a new vhost is added?

    Have you confirmed that the change is permanent?
  4. neuromancer

    neuromancer Guest

    D'oh! You're absolutely right. It got stomped. I just found your other post here:


    Is this working for you? If I make any changes to the domain setting, home/httpd/vhosts/(vhost)/conf/httpd.include still gets stompted on so I have to change plesklog to urchin again...

    For defining the custom log I guess do you suppose it's best to define the custom log format in home/httpd/vhosts/(vhost)/conf/vhost.conf and do it for each applicable host rather than etc/httpd/conf/httpd.conf, which worked also. This means I only have to define it once, but I'm not sure if changing any Plesk settings will overwrite this as well...
  5. serve-you.net

    serve-you.net Guest

    There is a FAQ just for you!
  6. neuromancer

    neuromancer Guest

    Thanks. This seems to be working.
    I say that with a little bit of hesitation because in the log file, there are now two lines being written for each request. One in the default format, and one in the LogFormat that I specified which includes cookies immediately below. I had to also add a line for CustomLog with a unique name (other than the default plesklog) and the LogFormat.

    As far as Urchin goes, it does not appear to have any trouble processing it and is showing the correct traffic level; and not double.

    I'll wait and see if it affects Plesk's traffic stats.
  7. synergypoint

    synergypoint Guest

    I tried FAQ with no success

    I tried following the FAQ but it didn't work.

    This is what I put into my vhost.conf file:

    LogFormat "%h %v %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Cookie}i\"" plesklog

    I thought it might redefine the plesklog format and cause Plesk to use it instead of the default format.

    It had no effect.

    The only thing I have been able to do is to create either an entirely new log file or store 2 entries for each log entry in the same log file.

    Has anyone had success with the FAQ method?
  8. wlaxa

    wlaxa Guest

    Anyone has a follow up with this?

    Just wondering what's the best way to implement this custom log thing...

    There should be a way where you can edit the skeleton httpd.include file so when plesk rewrites it, it rewrites with the proper / custom information that you need.

    It seems like a loose loose situation all around...
  9. JohnTKelly

    JohnTKelly Guest

    Got a reply from SWSoft tech support:

    Plesk uses hardcoded log format because it is needed by webalizer.
    If you wish to use own log format, there are two ways to solve the problem.

    1. Create own LogFormat and CustomLog in vhost.conf per domain basis.

    2. Redefine Plesk LogFormat in /etc/httpd/conf/httpd.conf after "Include
    /etc/httpd/conf/httpd.include" line. But in this case webalizer and
    Plesk statistics may not work.
  10. synergypoint

    synergypoint Guest

    Method 1 is what I have been doing.

    The only problem is that I either end up with 2 sets of log files or if I add my custom log entries to the default log file name, there are duplicate entries in the log file, one by the Plesklog format and my custom log format.

    Is there a way to completely disable the plesklog format per domain or to re-define it with my custom requirements so I don't end up with duplicates?
  11. dirty@

    dirty@ Guest

    this is quite flexible and correct solution...the only recommendation -- add your options to the end of format line.. because log is parsed by admin/sbin/statistics and by webalizer and they require IP, date, size and all other records come in order as defined in plesklog format..
  12. -ck-

    -ck- Guest

    Just wondering if anyone ever found an ideal solution to this?

    Solution 1 (adding custom log format to vhost.conf) has doubled the bandwidth statistics (plesk) and doubled the number of hits (in Urchin).

    Solution 2 - the ideal solution, but gets overwritten by Plesk.

    I tried redefining plesklog in vhost.conf with the addition of cookies, but this had no effect.

    I could specify a new log file solely for Urchin, but then we lose past statistics (going back years).

    So, so far, no ideal solution to a fairly common request (bug?) I would imagine?

  13. yozzy

    yozzy Guest

    make 2 log files

    If (I/O) issues are not a concern to you (you don't have much I/O wait) you can define 2 log files by adding the line CustomLog /var/www/vhosts/google.com/stats/logs/access_log {somelogdef}

    the original for plek will stay in place, the new one is for urchin, you can then make a new log rotation cron job for the new file..... so log rotation should not be a problem

    Don't do it like above exactly though, all i am trying to tell you is that you should be aware of SELINUX and make the new log file somewhere accessible by apache !

    What else... oh i am having a different kind of problem, i want to disable logging for domain, can't do that because it defined in the file plesk overwrites, and i don't think there is a way to change the location from within plesk (to dev/null ) for example, anyone got any ideas ?