• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Changing the logging of one/all domains

Loeffel

New Pleskian
Hi,

I want to anonymize my log files. For this I have a Perl script that replaces the last number of the IP with a zero. That runs fine with every webpage I have manually entered into the apache server. All Plesk build domains just didn't make it correct.

I have added the errorlog and the customlog into the vhost.conf. The result isn't exactly as expected. He is logging correctly through the perl script as pipe and the last ip triple is zeroed but!!!! he also logs the whole thing again. This time as formatted in the httpd.include. So every access makes two log lines. The correct one and the normal one.

So how can I disable the logging in the httpd.include or better alter the template, so that I can change it for all domains at once?

The the lines of the vhost.conf:
Code:
CustomLog  "|/srv/execute/aplog-anon /srv/www/vhosts/forum.modellkapitaene.net/statistics/logs/access_log" plesklog
ErrorLog  "|/srv/execute/aplog-anon /srv/www/vhosts/forum.modellkapitaene.net/statistics/logs/error_log"

This is the result in the logfile:
Code:
10.0.0.116 - - [02/Aug/2009:13:30:15 +0200] "GET /templates/subSilver/images/icon_mini_message.gif HTTP/1.1" 304 - "http://forum.modellkapitaene.net/" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)"
10.0.0.0 - - [02/Aug/2009:13:30:15 +0200] "GET /templates/subSilver/images/icon_mini_message.gif HTTP/1.1" 304 - "http://forum.modellkapitaene.net/" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)"
10.0.0.116 - - [02/Aug/2009:13:30:15 +0200] "GET /templates/subSilver/images/icon_mini_login.gif HTTP/1.1" 304 - "http://forum.modellkapitaene.net/" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)"
10.0.0.0 - - [02/Aug/2009:13:30:15 +0200] "GET /templates/subSilver/images/icon_mini_login.gif HTTP/1.1" 304 - "http://forum.modellkapitaene.net/" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)"

As you can see, everything is logged twice.
 
Hi,

I've found this thread looking for a posibility anonymizing the logs of some domains, hosted on my server (running Plesk 10.1.1).

Embedding the skript (http://www.zendas.de/technik/sicherheit/apache/scripte.html) via vhost.conf results in logging twice everything.

There is a second (better a first) CustomLog configuration statement in a generated .conf file in your .../vhosts/[YOUR DOMAIN]/conf directory causing the unwanted first log line with the unshortened IP-adress.

You can patch the generated file each time you change your configuration or you've to patch (or hack) the file domainVirtualHost.php in your /usr/local/psa/admin/conf/templates/default/domain directory.

I've replaced the lines:
Code:
<?php if (!$VAR->server->webserver->apache->pipelogEnabled): ?>
    CustomLog <?php echo $VAR->domain->physicalHosting->logsDir ?>/<?php echo $OPT['ssl'] ? 'access_ssl_log' : 'access_log' ?> plesklog
<?php endif; ?>
    ErrorLog  "<?php echo $VAR->domain->physicalHosting->logsDir ?>/error_log"

with:
Code:
<?php $shortlogconf = $VAR->domain->physicalHosting->vhostDir.'/conf/shortlog'; 
    $shortlogconf.= $OPT['ssl'] ? '_ssl.conf' : '.conf' ; ?>

<?php   if (!file_exists($shortlogconf)): ?>
<?php if (!$VAR->server->webserver->apache->pipelogEnabled): ?>
    CustomLog <?php echo $VAR->domain->physicalHosting->logsDir ?>/<?php echo $OPT['ssl'] ? 'access_ssl_log' : 'access_log' ?> plesklog
<?php endif; ?>
    ErrorLog  "<?php echo $VAR->domain->physicalHosting->logsDir ?>/error_log"
<?php else : ?>
    Include "<?php echo $shortlogconf ; ?>"
<?php endif; ?>

so domainVirtualHost.php (called by /usr/local/psa/admin/bin/httpdmng) looks for the file shortlog.conf / shortlog_ssl.conf in your private conf directory an includes the files (if existing) in your config INSTEAD of the original statements.

It seems to work fine...
But be to have backups from all the files you change. In addition: updating plesk will overwrite your patches!
 
Back
Top