From: "Csillag Tamás" <cstamas@digitus.itk.ppke.hu>
Cc: supervision@list.skarnet.org
Subject: Re: syslog from perl but no date (svlogd)
Date: Sat, 17 Jul 2004 12:27:06 +0200 [thread overview]
Message-ID: <20040717102706.GJ7203@digitus> (raw)
In-Reply-To: <20040716224352.GI7203@digitus>
On 07/17, Csillag Tamás wrote:
> I will look to the code if it can be imlemented without messing up the
> code.
>
> Do you know what could be a prefered way?
>
> Hmm, maybe some kind of processor can do the hard work for me.
> Maybe a perl script?
>
> I will mail it here if I have a working solution.
What do you think about this perl script?
____________________________________________________
#!/usr/bin/perl
use warnings;
use strict;
my $l;
while($l=<STDIN>) {
$l=~/(\d\d\d\d-\d\d-\d\d_\d\d:\d\d:\d\d.\d\d\d\d\d \w+.\w+:) \w\w\w \d\d \d\d:\d\d:\d\d (.+)/;
if(defined $1 and defined $2) {
print $1 . " " . $2 . "\n";
}
else {
print $l;
}
}
___________________________________________________
If I am not mistaken I can put this to svlogd's processor.
(!perl processor.pl | gzip -9)
$ cat file
2004-07-17_08:17:01.42255 user.notice: Jul 15 23:52:52 logger: test
3004-07-17_08:17:01.42255 mail.info: example.pl[3449]: test
4004-07-17_08:17:01.42255 user.notice: Jul 17 23:52:52 logger: test
5004-07-17_08:17:01.42255 mail.info: example.pl[3449]: test
$ cat file | perl processor.pl
2004-07-17_08:17:01.42255 user.notice: logger: test
3004-07-17_08:17:01.42255 mail.info: example.pl[3449]: test
4004-07-17_08:17:01.42255 user.notice: logger: test
5004-07-17_08:17:01.42255 mail.info: example.pl[3449]: test
--
cstamas
next prev parent reply other threads:[~2004-07-17 10:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-15 22:21 Csillag Tamás
2004-07-15 23:06 ` Charlie Brady
2004-07-16 22:43 ` Csillag Tamás
2004-07-17 10:27 ` Csillag Tamás [this message]
2004-07-17 10:59 ` Clemens Fischer
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=20040717102706.GJ7203@digitus \
--to=cstamas@digitus.itk.ppke.hu \
--cc=supervision@list.skarnet.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;
as well as URLs for NNTP newsgroup(s).