From: Nick Rout <nick@rout.co.nz>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Potential Supid question re Grep
Date: Fri, 08 Jul 2005 14:04:18 +1200 [thread overview]
Message-ID: <20050708140212.F6EE.NICK@rout.co.nz> (raw)
In-Reply-To: <42CDB2B6.9090307@asmallpond.org>
On Fri, 08 Jul 2005 00:54:46 +0200
Richard Fish wrote:
> Michael Thompson wrote:
>
> >I am trying to extract information in my logs for a abuse department and am
> >using the code:
> >
> >Code:
> >
> >zcat /var/log/messages.*?.gz | grep 212.56.68.108 >> /home/mike/abuse1
> >
> >The logs are standard: messages.??.gz
> >
> >However, when I examine the output, it starts on the 1st may, however the logs
> >contain details from the 25th Febuary. What am I doing wrong?
> >
> >
> >
>
> Are you *sure* the February information is not there?? I think this
> probably has nothing to do with the grep command, but more with the
> shell expansion. When I do "ls -l /var/log/messages.*?.gz", I get the
> following:
>
> -rw------- 1 root root 696588 Feb 21 09:00 /var/log/messages.1.gz
> -rw------- 1 root root 795675 Feb 14 15:40 /var/log/messages.2.gz
> -rw------- 1 root root 491964 Feb 6 19:00 /var/log/messages.3.gz
> -rw------- 1 root root 482189 Jan 31 05:10 /var/log/messages.4.gz
>
> Notice that the dates are in reverse order. If I were to cat those
> together, the oldest information would be at the end. I think you want:
>
> zcat `ls -rt /var/log/messages.*?.gz` | grep 212.56.68.108 >>
> /home/mike/abuse1
another potential problem is that if you have 10 or more rotated log
files you will get them in the order:
/var/log/messages.1.gz
/var/log/messages.10.gz
/var/log/messages.2.gz
>
> -Richard
>
> --
> gentoo-user@gentoo.org mailing list
--
Nick Rout
--
gentoo-user@gentoo.org mailing list
next prev parent reply other threads:[~2005-07-08 2:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-07 18:18 [gentoo-user] Potential Supid question re Grep Michael Thompson
2005-07-07 18:32 ` A. Khattri
2005-07-07 18:47 ` Michael Thompson
2005-07-07 19:19 ` A. Khattri
2005-07-07 22:54 ` Richard Fish
2005-07-08 2:04 ` Nick Rout [this message]
2005-07-08 23:30 ` Toby Cubitt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050708140212.F6EE.NICK@rout.co.nz \
--to=nick@rout.co.nz \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox