Linux
Append xdebug trace to script output
It possible to analyze xdebug traces with different tools, but sometimes you want to see it online. Lets create xdebug.yourdomain.com virtualhost, which will render the same page as yourdomain.com, but will add xdebug trace to the end.
Copy yourdomain.com virtualhost config, change ServerName and add these two lines to it:
Block request with empty referer
Sometimes it is useful to block requests with empty referer. This can be easily done with rewrite rules:
RewriteEngine On RewriteCond %{REQUEST_URI} /test/test\.php [NC] RewriteCond %{HTTP_REFERER} ^$ [NC] RewriteRule .* - [F,L] |
How to install Percona Server 5.5 on Centos 6.3
Add Percona repository to your yum repository list, like it’s written in http://www.percona.com/doc/percona-server/5.5/installation/yum_repo.html
Next try to install Percona Server
yum install Percona-Server-shared-55.x86_64 Percona-Server-server-55.x86_64 \ Percona-Server-client-55.x86_64 |
And probably you will get error:
Creating requests per time graph from nginx or apache access log
To create script that calculates values was simple part, but to create graph was a little bit tricky. But lets start from beginning…
Log file this script analyze look like this:
xx.xxx.xxx.xxx - - [20/Oct/2012:06:25:22 +0300] "GET ... HTTP/1.1" 200 80638 "..." "Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20100101 Firefox/16.0" xx.xx.xxx.xxx - - [20/Oct/2012:06:25:24 +0300] "GET ... HTTP/1.1" 200 80638 "..." "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C)" xxx.xx.x.xx - - [20/Oct/2012:06:25:25 +0300] "GET ... HTTP/1.1" 200 81302 "..." "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E; InfoPath.1)" xx.xx.xx.xx - - [20/Oct/2012:06:25:25 +0300] "GET ... HTTP/1.1" 200 102001 "..." "Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20100101 Firefox/16.0"
In order to calculate requests per time frame we need to have those time intervals. So we take first date from log file and change it to seconds since 1970-01-01 00:00:00 UTC and add 300s (5 mins).