# Pipe logfiles to perl script

**URL:** <https://www.ruby-forum.com/t/pipe-logfiles-to-perl-script/174692>\
**Category:** NGINX\
**Created:** [August 31, 2009, 3:14pm UTC](https://www.ruby-forum.com/t/pipe-logfiles-to-perl-script/174692 "2009-08-31T15:14:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gromminger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a4c791/32.png) [@gromminger](https://www.ruby-forum.com/u/gromminger)\
**Post date:** [August 31, 2009, 3:14pm UTC](https://www.ruby-forum.com/t/pipe-logfiles-to-perl-script/174692/1 "2009-08-31T15:14:17Z")

</div>

Hello Folks,

i am badly looking for a solution to get nginx pipe his logfiles …  
something like cronolog or in my case a special perl script. are there  
anyy solutions or patches around?

thanks

---

<div class="post-metadata">

**Author:** ![gromminger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a4c791/32.png) [@gromminger](https://www.ruby-forum.com/u/gromminger)\
**Post date:** [August 31, 2009, 3:53pm UTC](https://www.ruby-forum.com/t/pipe-logfiles-to-perl-script/174692/2 "2009-08-31T15:53:31Z")

</div>

On Mon, 2009-08-31 at 15:07 +0200, Juergen G. wrote:

> Hello Folks,
> 
> i am badly looking for a solution to get nginx pipe his logfiles …  
> something like cronolog or in my case a special perl script. are there  
> anyy solutions or patches around?

You can have multiple logs with nginx. Since logs are useful you may  
want to keep present configuration intact. Add another nginx logfile  
dedicated for your script usage and log there exactly what you script  
wants. Make it a a FIFO ( man mknod ) and read it from your script.

---

<div class="post-metadata">

**Author:** ![gromminger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a4c791/32.png) [@gromminger](https://www.ruby-forum.com/u/gromminger)\
**Post date:** [August 31, 2009, 3:54pm UTC](https://www.ruby-forum.com/t/pipe-logfiles-to-perl-script/174692/3 "2009-08-31T15:54:41Z")

</div>

On Mon, Aug 31, 2009 at 03:07:52PM +0200, Juergen G. wrote:

> Hello Folks,
> 
> i am badly looking for a solution to get nginx pipe his logfiles …  
> something like cronolog or in my case a special perl script. are there  
> anyy solutions or patches around?

No, nginx does not support pipe logging.  
The following contruction is almost the same in terms of CPU waste:

tail -F /path/to/access\_log | /path/to/perl/script

---

<div class="post-metadata">

**Author:** ![gromminger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a4c791/32.png) [@gromminger](https://www.ruby-forum.com/u/gromminger)\
**Post date:** [August 31, 2009, 4:40pm UTC](https://www.ruby-forum.com/t/pipe-logfiles-to-perl-script/174692/4 "2009-08-31T16:40:56Z")

</div>

On Mon, Aug 31, 2009 at 03:45:54PM +0200, Miros??aw Jaworski wrote:

> wants. Make it a a FIFO ( man mknod ) and read it from your script.  
> Currently nginx opens log files in blocking mode, therefore if script  
> will not be able to exhaust data from FIFO for some reason, then nginx  
> will blocks on log writing and will not be able to process requests.  
> If I will change this to nonblocking mode, then some data may be lost  
> on the smae terms.
