This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: tail -f will not work with IIS generated log files


>From cygwin-return-58541-listarch-cygwin=sourceware dot cygnus dot com at cygwin dot com Thu Sep 26 06:14:14 2002
Return-Path: <cygwin-return-58541-listarch-cygwin=sourceware dot cygnus dot com at cygwin dot com>
Delivered-To: listarch-cygwin at sourceware dot cygnus dot com
Received: (qmail 12794 invoked by alias); 26 Sep 2002 06:14:13 -0000
Mailing-List: contact cygwin-help at cygwin dot com; run by ezmlm
Precedence: bulk
List-Subscribe: <mailto:cygwin-subscribe at cygwin dot com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin at cygwin dot com>
List-Help: <mailto:cygwin-help at cygwin dot com>, <http://sources dot redhat dot com/ml/#faqs>
Sender: cygwin-owner at cygwin dot com
Mail-Followup-To: cygwin at cygwin dot com
Delivered-To: mailing list cygwin at cygwin dot com
Received: (qmail 12787 invoked from network); 26 Sep 2002 06:14:12 -0000
Received: from unknown (HELO mail.bluesguitar.org) (216.80.83.62)
  by sources dot redhat dot com with SMTP; 26 Sep 2002 06:14:12 -0000
Received: from guinness (guinness.bluesguitar.org [172.16.10.1])
        by mail dot bluesguitar dot org (Postfix) with SMTP
        id D1429D90027; Thu, 26 Sep 2002 01:14:11 -0500 (CDT)
Message-ID: <067901c26523$ee1e9e80$010a10ac@guinness>
From: "Matthew Smith" <matts at bluesguitar dot org>
To: "Cygwin" <cygwin at sources dot redhat dot com>
Cc: "Textutils" <bug-textutils at gnu dot org>
References: <55BAE1F3AB0DD41198B600508BA241B0043918FA@ehost002.intermedia.net>
Subject: Re: tail -f will not work with IIS generated log files
Date: Thu, 26 Sep 2002 01:14:11 -0500
MIME-Version: 1.0
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1106


Hi,

picking up on something really old:

http://www.cygwin.com/ml/cygwin/2002-09/msg01290.html

>> Bit of bummer because getting "tail" to monitor IIS was the VERY reason I
>> downloaded and installed www.CyGWin.com . I'm wondering:
>>
>>  1) When might someone fix this?
>
>It will get fixed as soon as you submit a patch for it!  Seriously.  All of
>the cygwin people work on a volunteer basis.  We all have lives/jobs to
>contend with, and contribute to cygwin when we can.  If you have a feature
>you must have, implement it.  It's that simple.
>
>>(extend "tail" to deal with the IIS log
>> tricks, and thus making a more powerful "tail")  tail doesn't display so is
>> surely stripping out pre-allocated buffer space at the end (perhaps because,
>> in MS-DOS, it's preceded by a ^Z), but not going back to see if that space
>> it skipped has changed, or just not noticing any changes because , as Robert
>> suggested, it's probably just looking at the size of the file. What it
>> probably should be looking at first is the mod-date, and when that changes,
>> continue outputting it's output at the point where it found no more valid
>> text, NOT necessarily the end of the file.  This minor redesign could then
>> be folded back into the Gnu sources, for a more powerful tail for everyone.
>
>I agree, it sounds simple. I eagerly await your changes.
>
>cheers,
>-Matt Smith
>cygwin textutils maintainer

I just faced the same problem and didn't find a solution digging through
the list and the net.  I had a look at modifying tail.c but couldn't grasp
it this morning.  So I came up with this not exactly pretty perl
solution:

use strict;
my ($pos,$file);

$file = $ARGV[0];

open(FH,$file) || die "$file: $!";

seek( FH, -70000, 2 ) || die; # goto eof -70000 bytes

while(1) {

   while(<FH>) {
     last if /\x00+/;
     print "$_";
     $pos = tell( FH );
   }
   close( FH );
   sleep 1;
   open(FH,$file) || die;
   seek( FH, $pos, 0 );
}

It doesn't work without the close/open pair, sigh.  And it
doesn't count lines.

Maybe someone more familiar with the tail source can port this to
tail.c?  As a side note: checking modification dates is useless,
they only change when IIS allocates a new chunk of zeroes.

Michael

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]