<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>linux-sysadmin.org</title>
	<atom:link href="http://linux-sysadmin.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://linux-sysadmin.org</link>
	<description>GNU/Linux administrator helper</description>
	<lastBuildDate>Fri, 14 Jan 2011 08:47:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Nginx (https) &#8211; Django via FastCgi</title>
		<link>http://linux-sysadmin.org/2011/01/nginx-https-django-via-fastcgi/</link>
		<comments>http://linux-sysadmin.org/2011/01/nginx-https-django-via-fastcgi/#comments</comments>
		<pubDate>Fri, 14 Jan 2011 08:47:01 +0000</pubDate>
		<dc:creator>linus</dc:creator>
				<category><![CDATA[others]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[Http]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://linux-sysadmin.org/?p=285</guid>
		<description><![CDATA[user&#160;&#160;nginx nginx; worker_processes&#160;&#160;1; error_log&#160;&#160;/www/log/error-ssl.log; pid&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;/var/run/nginx-ssl.pid; events { &#160;&#160;&#160;&#160;worker_connections&#160;&#160;16; &#160;&#160;&#160;&#160;} http { &#160;&#160;&#160;&#160;include&#160;&#160;&#160;&#160;&#160;&#160; mime.types; &#160;&#160;&#160;&#160;default_type&#160;&#160;application/octet-stream; &#160;&#160;&#160;&#160;log_format&#160;&#160;main &#039;&#34;$host&#34; &#34;$request&#34; &#34;[$time_local]&#34; &#34;$bytes_sent&#34;&#039;; &#160;&#160;&#160;&#160;access_log&#160;&#160;/www/log/access-ssl.log&#160;&#160;main; &#160;&#160;&#160;&#160;## General Options &#160;&#160;&#160;&#160;ignore_invalid_headers&#160;&#160; on; &#160;&#160;&#160;&#160;sendfile&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; on; &#160;&#160;&#160;&#160;server_tokens&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; off; &#160;&#160;&#160;&#160;gzip&#160;&#160;on; &#160;&#160;&#160;&#160;keepalive_timeout&#160;&#160;65; server { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;listen&#160;&#160;&#160;&#160;&#160;&#160; 443; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;server_name&#160;&#160;linux-sysadmin.org; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ssl on; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ssl_certificate /www/ssl/linux-sysadmin.org.crt; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ssl_certificate_key /www/ssl/linux-sysadmin.org.key.unsecure; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ssl_client_certificate /opt/nginx/conf/ssl/ca.crt; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ssl_verify_client&#160;&#160;&#160;&#160;&#160;&#160; on; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;access_log&#160;&#160;/www/log/linux-sysadmin.access-ssl.log&#160;&#160;main; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;location / { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;fastcgi_pass unix:/www/app/web/run/serviceMgmt.socket; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;# necessary parameter [...]]]></description>
			<content:encoded><![CDATA[<p><pre><code>
user&nbsp;&nbsp;nginx nginx;
worker_processes&nbsp;&nbsp;1;

error_log&nbsp;&nbsp;/www/log/error-ssl.log;
pid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/var/run/nginx-ssl.pid;

events {
&nbsp;&nbsp;&nbsp;&nbsp;worker_connections&nbsp;&nbsp;16;
&nbsp;&nbsp;&nbsp;&nbsp;}

http {

&nbsp;&nbsp;&nbsp;&nbsp;include&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mime.types;
&nbsp;&nbsp;&nbsp;&nbsp;default_type&nbsp;&nbsp;application/octet-stream;

&nbsp;&nbsp;&nbsp;&nbsp;log_format&nbsp;&nbsp;main &#039;&quot;$host&quot; &quot;$request&quot; &quot;[$time_local]&quot; &quot;$bytes_sent&quot;&#039;;
&nbsp;&nbsp;&nbsp;&nbsp;access_log&nbsp;&nbsp;/www/log/access-ssl.log&nbsp;&nbsp;main;

&nbsp;&nbsp;&nbsp;&nbsp;## General Options
&nbsp;&nbsp;&nbsp;&nbsp;ignore_invalid_headers&nbsp;&nbsp; on;
&nbsp;&nbsp;&nbsp;&nbsp;sendfile&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; on;
&nbsp;&nbsp;&nbsp;&nbsp;server_tokens&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; off;

&nbsp;&nbsp;&nbsp;&nbsp;gzip&nbsp;&nbsp;on;
&nbsp;&nbsp;&nbsp;&nbsp;keepalive_timeout&nbsp;&nbsp;65;

 server {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 443;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;server_name&nbsp;&nbsp;linux-sysadmin.org;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ssl on;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ssl_certificate /www/ssl/linux-sysadmin.org.crt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ssl_certificate_key /www/ssl/linux-sysadmin.org.key.unsecure;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ssl_client_certificate /opt/nginx/conf/ssl/ca.crt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ssl_verify_client&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; on;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;access_log&nbsp;&nbsp;/www/log/linux-sysadmin.access-ssl.log&nbsp;&nbsp;main;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;location / {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fastcgi_pass unix:/www/app/web/run/serviceMgmt.socket;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# necessary parameter
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fastcgi_param PATH_INFO $fastcgi_script_name;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# to deal with POST requests
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fastcgi_param REQUEST_METHOD $request_method;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fastcgi_param CONTENT_TYPE $content_type;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fastcgi_param CONTENT_LENGTH $content_length;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# necessary parameter for https
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fastcgi_param&nbsp;&nbsp;HTTPS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;on;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;location /media {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;root /www/app/web; 

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}

</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://linux-sysadmin.org/2011/01/nginx-https-django-via-fastcgi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django (socket access) &#8211; init startup script for Gentoo</title>
		<link>http://linux-sysadmin.org/2011/01/django-socket-access-init-startup-script-for-gentoo/</link>
		<comments>http://linux-sysadmin.org/2011/01/django-socket-access-init-startup-script-for-gentoo/#comments</comments>
		<pubDate>Fri, 14 Jan 2011 08:41:48 +0000</pubDate>
		<dc:creator>linus</dc:creator>
				<category><![CDATA[others]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[Http]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://linux-sysadmin.org/?p=277</guid>
		<description><![CDATA[#!/sbin/runscript&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; opts=&#34;${opts} stop start&#34; depend() { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;need net &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;use dns logger netmount &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;after ntpd } DJANGO_SITE=&#34;serviceMgmt&#34; SITES_PATH=/www/app/web RUNFILES_PATH=$SITES_PATH/run RUN_AS=django PYTHON_EGG_CACHE=/tmp export PYTHON_EGG_CACHE start() { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ebegin &#34;Starting django-fgci&#34; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;chmod -R 777 $SITES_PATH &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if [ -f $RUNFILES_PATH/$DJANGO_SITE.pid ]; then &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ewarn &#34;Django already running ($RUNFILES_PATH/$DJANGO_SITE.pid)&#34; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;else &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;start-stop-daemon --start \ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;--pidfile $RUNFILES_PATH/$DJANGO_SITE.pid \ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;--chuid $RUN_AS \ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;--exec /usr/bin/python $SITES_PATH/$DJANGO_SITE/manage.py [...]]]></description>
			<content:encoded><![CDATA[<p><pre><code>
#!/sbin/runscript&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 

opts=&quot;${opts} stop start&quot;

depend() {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;need net 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;use dns logger netmount
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;after ntpd
}

DJANGO_SITE=&quot;serviceMgmt&quot;
SITES_PATH=/www/app/web
RUNFILES_PATH=$SITES_PATH/run
RUN_AS=django
PYTHON_EGG_CACHE=/tmp

export PYTHON_EGG_CACHE

start() {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ebegin &quot;Starting django-fgci&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chmod -R 777 $SITES_PATH
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if [ -f $RUNFILES_PATH/$DJANGO_SITE.pid ]; then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ewarn &quot;Django already running ($RUNFILES_PATH/$DJANGO_SITE.pid)&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;start-stop-daemon --start \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--pidfile $RUNFILES_PATH/$DJANGO_SITE.pid \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--chuid $RUN_AS \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--exec /usr/bin/python $SITES_PATH/$DJANGO_SITE/manage.py runfcgi \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;socket=$RUNFILES_PATH/$DJANGO_SITE.socket \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pidfile=$RUNFILES_PATH/$DJANGO_SITE.pid
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chmod 777 $RUNFILES_PATH/$DJANGO_SITE.socket
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;einfo &quot;Django started&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eend $?
}

stop() {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ebegin &quot;Stopping django-fgci&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VERBOSE_NAME=&quot;$DJANGO_SITE&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;start-stop-daemon --stop \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--pidfile $RUNFILES_PATH/$DJANGO_SITE.pid \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;&amp; einfo &quot;Django stopped&quot; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|| ewarn &quot;Django not running&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if [ -f $RUNFILES_PATH/$DJANGO_SITE.pid ]; then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rm $RUNFILES_PATH/$DJANGO_SITE.pid
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rm $RUNFILES_PATH/$DJANGO_SITE.socket
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eend $?
}
</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://linux-sysadmin.org/2011/01/django-socket-access-init-startup-script-for-gentoo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best way for NGINX logs rotation</title>
		<link>http://linux-sysadmin.org/2010/12/best-way-for-nginx-logs-rotation/</link>
		<comments>http://linux-sysadmin.org/2010/12/best-way-for-nginx-logs-rotation/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 13:48:07 +0000</pubDate>
		<dc:creator>linus</dc:creator>
				<category><![CDATA[others]]></category>
		<category><![CDATA[Http]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[logs rotation]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[patch]]></category>

		<guid isPermaLink="false">http://linux-sysadmin.org/?p=271</guid>
		<description><![CDATA[Best way for NGINX logs rotation I wanted rotate access logs every minute without HUP signal or reopen utility. Why? Because, i wanted fluently write into logs and logs must contain access for 1 minute. I didn&#8217;t want call reopen utility and then move file, because i moved files from quick (heap) storage to slow [...]]]></description>
			<content:encoded><![CDATA[<h1>Best way for NGINX logs rotation</h1>
<p>I wanted rotate access logs every minute without HUP signal or reopen utility.<br />
Why? Because, i wanted fluently write into logs and logs must contain access<br />
for 1 minute. I didn&#8217;t want call reopen utility and then move file, because i moved<br />
files from quick (heap) storage to slow storage.</p>
<p>Finally i did patch which you can find in tools <a title="tools section" href="http://linux-sysadmin.org/tools/">section</a>.</p>
<p><em>Installation:<br />
</em><strong><br />
1, download patch<br />
2, download nginx 0.8.53<br />
3, extract nginx and go to the src dir<br />
4, call patch: patch  -p0 -i &lt;path_to_dir_where_is_patch&gt;/bbcdnTime0.8.53.patch<br />
5, set in your nginx.conf something like this (keyword is $date_bbcdn) :</strong><em><br />
</em><br />
access_log  /logdir/access_$date_bbcdn.access.log  log;</p>
<p>and then you can see access logs in following format:<br />
<em>access_1293111000.access.log</em></p>
<p>And now you have new log every minute without any rotation script.</p>
]]></content:encoded>
			<wfw:commentRss>http://linux-sysadmin.org/2010/12/best-way-for-nginx-logs-rotation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx log rotate patch</title>
		<link>http://linux-sysadmin.org/2010/12/nginx-log-rotate-patch/</link>
		<comments>http://linux-sysadmin.org/2010/12/nginx-log-rotate-patch/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 13:42:32 +0000</pubDate>
		<dc:creator>linus</dc:creator>
				<category><![CDATA[tools]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[logs rotation]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[patch]]></category>

		<guid isPermaLink="false">http://linux-sysadmin.org/?p=267</guid>
		<description><![CDATA[Description: Patch for rotating access logs every minute Download: bbcdnTime0.8.53.patch Installation: 1, download patch 2, download nginx 0.8.53 3, extract nginx and go to the src dir 4, call patch: patch  -p0 -i &#60;path_to_dir_where_is_patch&#62;/bbcdnTime0.8.53.patch 5, set in your nginx.conf something like this (keyword is $date_bbcdn) : access_log  /logdir/access_$date_bbcdn.access.log  log; and then you can see access [...]]]></description>
			<content:encoded><![CDATA[<p>Description: Patch for rotating access logs every minute</p>
<p>Download: <a title="Nginx Log Rotate Patch" href="http://linux-sysadmin.org/download/bbcdnTime0.8.53.patch">bbcdnTime0.8.53.patch</a></p>
<p>Installation:</p>
<p>1, download patch<br />
2, download nginx 0.8.53<br />
3, extract nginx and go to the src dir<br />
4, call patch: patch  -p0 -i &lt;path_to_dir_where_is_patch&gt;/bbcdnTime0.8.53.patch<br />
5, set in your nginx.conf something like this (keyword is <em>$date_bbcdn</em>) :</p>
<p><em>access_log  /logdir/access_$date_bbcdn.access.log  log;</em></p>
<p>and then you can see access logs in following format:<br />
<em>access_1293111000.access.log</em></p>
<p><em><br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://linux-sysadmin.org/2010/12/nginx-log-rotate-patch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux cmd tips &#8211; better less</title>
		<link>http://linux-sysadmin.org/2010/08/linux-cmd-tips-better-less/</link>
		<comments>http://linux-sysadmin.org/2010/08/linux-cmd-tips-better-less/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 12:41:43 +0000</pubDate>
		<dc:creator>linus</dc:creator>
				<category><![CDATA[os-administration]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://linux-sysadmin.org/?p=75</guid>
		<description><![CDATA[1, Exit but leave content on screen i often use less, but that&#8217;s horrible when you do exit and then you will see only terminal without the content. I found in manual function: -X or &#8211;no-init Disables sending the termcap initialization and deinitialization strings to the terminal.  This is  sometimes  desirable  if  the deinitialization  string [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>1, Exit but leave content on screen</strong></em></p>
<p>i often use less, but that&#8217;s horrible when you do exit and then</p>
<p>you will see only terminal without the content.</p>
<p>I found in manual function:</p>
<p><em>-X or &#8211;no-init<br />
Disables sending the termcap initialization and deinitialization<br />
strings to the terminal.  This is  sometimes  desirable  if  the<br />
deinitialization  string does something unnecessary, like clear‐<br />
ing the screen.</em></p>
<p>great function, now you can read text file and after exit (q button) you</p>
<p>can see the content of text file.</p>
<p>example:</p>
<p><em>less -X test.txt</em></p>
<p>That&#8217;s fine, you can do some alias for &#8220;<em>less -X&#8221;, but when are you connected in new</em></p>
<p><em>server then is your new function of less out. So, what will we do with this? <img src='http://linux-sysadmin.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </em></p>
<p>Just easy use your <em>.bashr</em>c or <em>.bash_profile </em>config file and put into this file:</p>
<p><em><strong>export LESS=X</strong></em></p>
<p>and then you have perfect <em>less</em> cmd <img src='http://linux-sysadmin.org/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>2, read your file with less and edit at the moment</p>
<p>In the manual you can find function:</p>
<p><em>v  &#8212;   Invokes  an editor to edit the current file being  viewed.  The editor is taken from the environment variable VISUAL if  defined, or EDITOR if VISUAL is not defined, or defaults to &#8220;vi&#8221; if  neither VISUAL nor EDITOR is defined.  See also the discussion of  LESSEDIT under  the  section    on PROMPTS below.</em></p>
<p>Example:</p>
<p>read your file with less command and if you want edit this file just press <em><strong>&#8220;v&#8221;</strong></em>.</p>
<p>If you know more tips for less, tell me this please in discussion&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://linux-sysadmin.org/2010/08/linux-cmd-tips-better-less/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create SW RAID from disks which were in HW &#8230;</title>
		<link>http://linux-sysadmin.org/2010/08/create-sw-raid-from-disks-which-were-in-hw/</link>
		<comments>http://linux-sysadmin.org/2010/08/create-sw-raid-from-disks-which-were-in-hw/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 12:53:30 +0000</pubDate>
		<dc:creator>linus</dc:creator>
				<category><![CDATA[os-administration]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://linux-sysadmin.org/?p=73</guid>
		<description><![CDATA[Create SW RAID from disks which were in HW RAID ARRAY When i built my new server, i got disks from old server. In old server was HW RAID array and the new server doesn&#8217;t supports HW RAID. So, i boot sysrescue CD on server and when i built new raid array i saw this [...]]]></description>
			<content:encoded><![CDATA[<h2><strong>Create SW RAID from disks which were in HW RAID ARRAY</strong></h2>
<p>When i built my new server, i got disks from old server.</p>
<p>In old server was <strong>HW RAID </strong>array and the new server doesn&#8217;t supports HW RAID.</p>
<p>So, i boot sysrescue CD on server and when i built new raid array i saw this message:</p>
<p><strong><em>mdadm: device /dev/sda not suitable for any style of array</em></strong></p>
<p><strong><em><br />
</em></strong></p>
<p>Unfortunately systemrescue want create hw raid, because he see some flags in old disk.</p>
<h3><em>$ dmsetup status</em></h3>
<p>shows some hw arrays.</p>
<p>You can remove all hw raids with</p>
<h3><em>$ dmsetup remove_all</em></h3>
<p>but, after the restart system see only hw raid in degrade mode, because hw raid looks like one disk.</p>
<p>How i can repair it?</p>
<p>You must remove some blocks in the end of partition, where is info about HW RAID.</p>
<p>For example:</p>
<blockquote><p>1, show your disk capacity in sectors</p>
<p><em>fdisk -lu /dev/sda</em></p>
<p><em>Disk /dev/sda5: 20.3 GB, 20341085184 bytes<br />
255 heads, 63 sectors/track, 2472 cylinders, total 39728682 sectors<br />
Units = sectors of 1 * 512 = 512 bytes</em></p>
<p>2, and then you can remove last 10MB blocks where are information about HW RAID</p>
<p><em>$ dd if=/dev/zero of=/dev/sda bs=512 seek=</em>39718442</p>
<p>After build array and reboot system you don&#8217;t see any hw raid device in</p>
<p><em>$ dmsetup status</em></p>
<p>and then you will see nothing and problem with</p>
<p><strong><em>mdadm: device /dev/sda not suitable for any style of array</em></strong></p>
<p><em>is gone&#8230;</em></p></blockquote>
<p><em><br />
</em></p>
<p>That&#8217;s all <img src='http://linux-sysadmin.org/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://linux-sysadmin.org/2010/08/create-sw-raid-from-disks-which-were-in-hw/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Http traffic monitor/reporting for Apache Web Server</title>
		<link>http://linux-sysadmin.org/2010/08/http-traffic-monitorreporting-for-apache-web-server/</link>
		<comments>http://linux-sysadmin.org/2010/08/http-traffic-monitorreporting-for-apache-web-server/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 12:46:28 +0000</pubDate>
		<dc:creator>linus</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://linux-sysadmin.org/?p=77</guid>
		<description><![CDATA[How you can monitor your http traffic? I was creating small python script which can analyse your http traffic via apache access log. The name of my script is  apacheLogReport. Result of script shows grouped report of network traffic sorted by hostname, referer and file. He is useful when you finding what makes your http [...]]]></description>
			<content:encoded><![CDATA[<p><strong>How you can monitor your http traffic?</strong></p>
<p>I was creating small python script which can analyse your http traffic via apache access log.</p>
<p>The name of my script is  <strong><em></em><em>apacheLogReport.</em></strong></p>
<p>Result of script shows grouped report of network traffic sorted by  hostname, referer and file. He is useful when you finding what makes  your http traffic.</p>
<p>How to use this script:</p>
<p>At first you must edit your apache <strong>httpd.conf</strong> file.</p>
<p>Find you virtual host for monitoring and insert these lines:</p>
<p><em>TransferLog &#8220;|/rotatelogs /www/log/httpd-access-analyze.log 3600&#8243;<br />
LogFormat &#8220;&#8216;%h&#8217; &#8216;%f&#8217;  &#8216;%{Referer}i\&#8217; &#8216;%b&#8217;&#8221;</em></p>
<p><strong><em>Attention: set your paths to rotatelogs and access log correctly!<br />
</em></strong></p>
<p>So, the hardest work is behind us <img src='http://linux-sysadmin.org/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Now, run a check result of script.</p>
<p><em>$chmod +x apacheLogReport.py</em></p>
<p><em>$./apacheLogReport.py &#8211;help<br />
Usage: apacheLogReport.py [options] args</em></p>
<p><em>Options:<br />
&#8211;version             show program&#8217;s version number and exit<br />
-h, &#8211;help            show this help message and exit<br />
-d, &#8211;description     Detail info<br />
-f FILE, &#8211;file=FILE  Specify which file to analyze<br />
-l LIMIT, &#8211;limit=LIMIT<br />
Items limit (default 10)</em></p>
<p><em>$./apacheLogReport.py -f </em><em> /www/log/httpd-access-analyze.log -l 20</em></p>
<p><em><strong>example of result:</strong></em></p>
<p><em><strong><img title="apacheLogReport" src="http://linux-sysadmin.org/photo/apacheLogReport.jpg" alt="apacheLogReport" width="640" height="293" /><br />
</strong></em></p>
<p><em><strong></p>
<hr /></strong></em></p>
<p>Download links:</p>
<p><a href="http://linux-sysadmin.org/download/apacheLogReport.py.gz">apacheLogReport</a> from this site</p>
<p><a href="http://downloads.sourceforge.net/project/apachelogreport/Apache%20access%20log%20report/0.91/apacheLogReport.py.gz?use_mirror=switch">apacheLogReport </a>form sourceforge.net</p>
<p>Do you have any idea for improvements?</p>
<p>Tell me please your opinion discussion.</p>
<p>Thank you!</p>
]]></content:encoded>
			<wfw:commentRss>http://linux-sysadmin.org/2010/08/http-traffic-monitorreporting-for-apache-web-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Log your request or query string in request by specific term</title>
		<link>http://linux-sysadmin.org/2010/08/log-your-request-or-query-string-in-request-by-specific-term/</link>
		<comments>http://linux-sysadmin.org/2010/08/log-your-request-or-query-string-in-request-by-specific-term/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 12:40:01 +0000</pubDate>
		<dc:creator>linus</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://linux-sysadmin.org/?p=81</guid>
		<description><![CDATA[Do you want log only specific request and not all http requests? It&#8217;s easy with apache module setenvif_module Your options (terms) for logging are: Remote_Host Remote_Addr Server_Addr Request_Method Request_Protocol Request_URI for example i have some requests like this: http://linux-sysadmin.org/cms/show_article/8001.html?query=2 http://linux-sysadmin.org/cms/show_categories/6025_1.html?query=5 I want log request which contain word article and number 8001 in httpd.conf: SetEnvIf Request_URI [...]]]></description>
			<content:encoded><![CDATA[<p>Do you want log only specific request and not all http requests?</p>
<p>It&#8217;s easy with apache module <em><strong>setenvif_module</strong></em></p>
<p>Your options (terms) for logging are:</p>
<ul>
<li><code>Remote_Host</code></li>
<li><code>Remote_Addr</code></li>
<li><code>Server_Addr</code></li>
<li><code>Request_Method</code></li>
<li><code>Request_Protocol</code></li>
<li><code>Request_URI</code></li>
</ul>
<p>for example i have some requests like this:</p>
<p><em>http://linux-sysadmin.org/cms/show_article/8001.html?query=2</em></p>
<p><em>http://linux-sysadmin.org/cms/show_categories/6025_1.html</em><em>?query=5</em></p>
<p>I want log request which contain word <em>article</em> and number <em>8001</em></p>
<p><em>in <strong>httpd.conf:</strong></em></p>
<p><em>SetEnvIf Request_URI (article) my_request<br />
SetEnvIf Request_URI (8001) my_request</em></p>
<p><em>CustomLog &#8220;|/opt/apache/bin/rotatelogs /var/web/log/httpd-test-access.log 3600&#8243; \ </em></p>
<p><em>&#8220;%h \&#8221;%r\&#8221; %t \&#8221;%{Referer}i\&#8221;" env=</em><em>my_request</em></p>
<p><em></em><em><br />
</em></p>
<p>That&#8217;s is easy, but what must i do if i want log request by query string?</p>
<p>Unfortunately <em>SetEnvIf </em>can&#8217;t work for this problem, but you can use mod_rewrite module</p>
<p>and combine it with <em>SetEnvIf.</em></p>
<p>Example of use (i want log request where query string is <em>&#8216;query=2&#8242; </em>+ previous terms):</p>
<p><em>in <strong>httpd.conf:</strong></em></p>
<p><em>RewriteEngine On</em></p>
<p><em>SetEnvIf Request_URI (article)  my_request<br />
SetEnvIf Request_URI (8001) my_request</em></p>
<p><em>RewriteCond %{QUERY_STRING}  (</em><em>query=2</em><em>)<br />
RewriteRule  (.*)   $1 [E=</em><em>my_request</em><em>:yes]</em></p>
<p><em>CustomLog  &#8220;|/opt/apache/bin/rotatelogs /var/web/log/httpd-test-access.log 3600&#8243; \ </em></p>
<p><em>&#8220;%h  \&#8221;%r\&#8221; %t \&#8221;%{Referer}i\&#8221;" env=</em><em>my_request</em></p>
<p>Easy? <img src='http://linux-sysadmin.org/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> <em></em><em> </em></p>
<p>I didn&#8217;t use special regexp. Of course, you can use very difficult regular (regexp) patterns</p>
<p>for find your specific request.</p>
<p><strong><br />
</strong></p>
<p><strong>Tags: <em>Apache Httpd, SetEnvIf, mod_rewrite, </em><em></em><em>CustomLog, request</em></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://linux-sysadmin.org/2010/08/log-your-request-or-query-string-in-request-by-specific-term/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Great tools for tuning mysql server variables.</title>
		<link>http://linux-sysadmin.org/2010/08/great-tools-for-tuning-mysql-server-variables-2/</link>
		<comments>http://linux-sysadmin.org/2010/08/great-tools-for-tuning-mysql-server-variables-2/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 12:38:39 +0000</pubDate>
		<dc:creator>linus</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://linux-sysadmin.org/?p=83</guid>
		<description><![CDATA[My favourite scripts for tuning mysql server variables are: 1, tuning-primer.sh This script takes information from &#8220;SHOW STATUS LIKE&#8230;&#8221; and &#8220;SHOW VARIABLES LIKE&#8230;&#8221; then attempts to produce sane recommendations for tuning server variables. It is compatible with all versions of MySQL 3.23 &#8211; 5.1. How to use: a, download b, edit tunnig-primer.sh via your favourite [...]]]></description>
			<content:encoded><![CDATA[<p>My favourite scripts for tuning mysql server variables are:</p>
<p>1, <strong>tuning-primer.sh</strong></p>
<p>This script takes information from &#8220;SHOW STATUS LIKE&#8230;&#8221;<br />
and &#8220;SHOW  VARIABLES LIKE&#8230;&#8221; then attempts to produce sane recommendations<br />
for  tuning server variables. It is compatible with all versions of MySQL  3.23 &#8211; 5.1.</p>
<p>How to use:</p>
<p>a, download</p>
<p>b, edit tunnig-primer.sh via your favourite text editor and set path to your <strong><em>socket</em></strong></p>
<p>at line 38</p>
<p>c, run with your favourite arguments (without arguments is the best choice):</p>
<p><em>#########################################################################<br />
#                                                                       #<br />
# Little known feature: 1st argument is execution mode                  #<br />
#                                                                       #<br />
#       Usage: ./tuning-primer.sh [ mode ]                              #<br />
#                                                                       #<br />
#       Available Modes:                                                #<br />
#               all :           perform all checks (default)            #<br />
#               prompt :        prompt for login credintials and socket #<br />
#                               and execution mode                      #<br />
#               mem, memory :   run checks for tunable options which    #<br />
#                               effect memory usage                     #<br />
#               disk, file :    run checks for options which effect     #<br />
#                               i/o performance or file handle limits   #<br />
#               innodb :        run InnoDB checks /* to be improved */  #<br />
#               misc :          run checks for that don&#8217;t categorise    #<br />
#                               well Slow Queries, Binary logs,         #<br />
#                               Used Connections and Worker Threads     #<br />
########################################################################</em></p>
<p>2, <strong>mysqltuner.pl</strong></p>
<p>is similar like  <strong>tuning-primer.sh.</strong></p>
<p>options for mysqltuner are:</p>
<p><em>Connection and Authentication<br />
&#8211;host &lt;hostname&gt;    Connect to a remote host to perform tests (default: localhost)<br />
&#8211;port &lt;port&gt;        Port to use for connection (default: 3306)<br />
&#8211;user &lt;username&gt;    Username to use for authentication<br />
&#8211;pass &lt;password&gt;    Password to use for authentication</p>
<p>Performance and Reporting Options<br />
&#8211;skipsize           Don&#8217;t enumerate tables and their types/sizes (default: on)<br />
(Recommended for servers with many tables)<br />
&#8211;checkversion       Check for updates to MySQLTuner (default: don&#8217;t check)<br />
&#8211;forcemem &lt;size&gt;    Amount of RAM installed in megabytes<br />
&#8211;forceswap &lt;size&gt;   Amount of swap memory configured in megabytes</p>
<p>Output Options:<br />
&#8211;nogood             Remove OK responses<br />
&#8211;nobad              Remove negative/suggestion responses<br />
&#8211;noinfo             Remove informational responses<br />
&#8211;nocolor            Don&#8217;t print output in color</em></p>
<p><strong><br />
</strong></p>
<p>Both are great <strong> </strong>MySQL High Performance Tuning Scripts.</p>
<p>I prefer <strong>tuning-primer.sh, because is written in bash.</strong></p>
<p><strong><br />
</strong></p>
<p><strong> </strong><strong>Download links:</strong></p>
<p><a href="https://launchpad.net/mysql-tuning-primer"><strong>tuning-primer.sh</strong></a></p>
<p><a href="http://mysqltuner.pl/mysqltuner.pl"><strong>mysqltuner.pl</strong></a></p>
<p><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://linux-sysadmin.org/2010/08/great-tools-for-tuning-mysql-server-variables-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql pager, filter your output</title>
		<link>http://linux-sysadmin.org/2010/08/mysql-pager-filter-your-output/</link>
		<comments>http://linux-sysadmin.org/2010/08/mysql-pager-filter-your-output/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 12:37:05 +0000</pubDate>
		<dc:creator>linus</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://linux-sysadmin.org/?p=85</guid>
		<description><![CDATA[Mysql pager is great feature for filter your processlist and others results. You can use your commands before displaying output to you. Examples: mysql&#62; pager less mysql&#62; pager cat ok, it was easy and without gain. Better examples: 1, show only specific pattern in result mysql&#62; pager grep -i localhost PAGER set to &#8216;grep -i [...]]]></description>
			<content:encoded><![CDATA[<p>Mysql pager is great feature for filter your processlist and others results.</p>
<p>You can use your commands before displaying output to you.</p>
<p>Examples:</p>
<p>mysql&gt; <em>pager less</em></p>
<p>mysql&gt; pager cat</p>
<p>ok, it was easy and without gain.</p>
<p>Better examples:</p>
<p><strong>1, show only specific pattern in result</strong></p>
<p>mysql&gt; <em>pager grep -i localhost</em><br />
PAGER set to &#8216;grep -i localhost&#8217;<br />
mysql&gt; <em>show processlist;</em><br />
| 377113 | smith      | localhost       | test | Sleep   | 46622 |       | NULL             |<br />
| 377115 | smith      | localhost       | test | Sleep   | 46348 |       | NULL             |<br />
| 392250 | smith      | localhost       | test | Query   |     0 | NULL  | show processlist |<br />
<em>13 rows in set (0.00 sec)</em></p>
<p><strong>2, count occurrence of pattern</strong></p>
<p>mysql&gt; <em>pager (grep -i localhost | wc -l)</em><br />
PAGER set to &#8216;(grep -i localhost | wc -l)&#8217;<br />
mysql&gt; <em>show processlist;</em><br />
3<br />
13 rows in set (0.00 sec)</p>
<p><strong>3, show queries in Sleep status which have time bigger then 40 seconds</strong></p>
<p>mysql&gt;<em> pager (grep -i Sleep | awk &#8216;$12 &gt; 40&#8242;)</em><br />
PAGER set to &#8216;(grep -i Sleep | awk &#8216;$12 &gt; 40&#8242;)&#8217;<br />
mysql&gt; <em>show processlist;</em><br />
| 377113 | smith      | localhost       | test | Sleep   | 46851 |       | NULL             |<br />
| 377115 | smith      | localhost       | test | Sleep   | 46577 |       | NULL             |<br />
| 392209 | smith | localhost | test | Sleep   |    91 |       | NULL             |<br />
| 392233 | smith | localhost | test | Sleep   |   121 |       | NULL             |<br />
| 392235 | smith | localhost | test | Sleep   |    61 |       | NULL             |<br />
| 392236 | smith | localhost | test | Sleep   |    61 |       | NULL             |<br />
13 rows in set (0.00 sec)</p>
<p><strong>4, sort result by Command</strong></p>
<p><em>mysql&gt; pager sort -k 12<br />
PAGER set to &#8216;sort -k 12&#8242;</em></p>
<p><strong><em>5, sort result by user</em></strong></p>
<p>mysql&gt; <em>pager sort -k 4 </em><br />
<em>PAGER set to &#8216;sort -k 4&#8242;</em></p>
<p><strong><em>6, </em></strong><strong><em>sort result by host</em></strong></p>
<p>mysql&gt; <em>pager sort -k 6</em><br />
<em>PAGER set to &#8216;sort -k 6&#8242;</em></p>
<p><em><strong>7, sort by everything what you want</strong></em></p>
<p>mysql&gt; <em>pager sort -k [your column]</em></p>
<p><strong>8, show your specific user which have time bigger then 40 seconds</strong></p>
<p>mysql&gt; <em>pager awk &#8216;$4 ~/smith/ &amp;&amp; $12 &gt; 40&#8242;<br />
PAGER set to &#8216;awk &#8216;$4 ~/</em><em>smith</em><em>/ &amp;&amp; $12 &gt; 40&#8221;</em><br />
mysql&gt; <em>show processlist;<br />
| 392209 | </em><em>smith</em><em> | localhost| test | Sleep   |   109 |       | NULL             |<br />
| 392210 | </em><em>smith</em><em> | </em><em>localhost</em><em> | test | Sleep   |    49 |       | NULL             |<br />
| 392217 | </em><em>smith</em><em> | </em><em>localhost</em><em> | test | Sleep   |    49 |       | NULL             |<br />
| 392232 | </em><em>smith</em><em> | </em><em>localhost</em><em> | test | Sleep   |    49 |       | NULL             |<br />
| 392233 | </em><em>smith</em><em> | </em><em>localhost</em><em> | test | Sleep   |   139 |       | NULL             |<br />
| 392235 | </em><em>smith</em><em> | </em><em>localhost</em><em> | test | Sleep   |    79 |       | NULL             |<br />
| 392236 | </em><em>smith</em><em> | </em><em>localhost</em><em>| test | Sleep   |    79 |       | NULL             |</em></p>
<p><em><strong>9, you can use your script, or everything else. Only your mind is the limit <img src='http://linux-sysadmin.org/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </strong></em></p>
]]></content:encoded>
			<wfw:commentRss>http://linux-sysadmin.org/2010/08/mysql-pager-filter-your-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

