Rattaching a running process to a screen

Reptyr is a small project written in C that enable you to “re-pty” your process. It means you can, for example, attach a running process inside a screen.

For example, you launched irssi outside your screen, and you do not want to relaunch it.

Install reptyr, then, in a screen, run the following commands:

$ pidof irssi
$ reptyr 27518

That’s it. The process will be rattached to Init but you will be able to use it directly from your screen, without notifying the difference.

Tested and approved to rattach a 6-hour process launched outside a screen.

  • Reptyr: Tested and approved
  • Retty: Alternative, more limitations and only for x86
Permalink. Category: Linux. Tags: sysadmin screen planet-inuits.
First published on Tue 25 June 2013.

Grok and httpd

When you use the LogFormat parameter in you apache configuration, you may want to use the same logformat in logstash.

I made a small table that will enable you to “translate” your custom log format into a grok pattern.

httpd grok
%T %{NUMBER:duration_seconds}
%D %{NUMBER:duration_microseconds}
%h %{IPORHOST:client}
%l %{USERNAME:remotelogname}
%u %{USERNAME:username}
%t \[%{HTTPDATE:timestamp}\]
%r %{USERNAME:method} %{URIPATHPARAM:request} HTTP/%{NUMBER:httpversion}
%s %{NUMBER:response}
%B %{NUMBER:bytes}
%b (?:%{NUMBER:bytes}|-)
\"%{Referer}i\" %{QS:referer}
\"%{User-Agent}i\" %{QS:useragent}
Permalink. Category: Monitoring. Tags: grok logstash planet-inuits.
First published on Mon 17 June 2013.