Le vendredi 02 avril 2004 à 13:00, Philippe 'BooK' Bruhat écrivait:
>
> On peut se contenter de faire :
>
> my $input = Locust::Input->new(
> $handle, # IO:Handle obtenu par ailleurs
> match => qr/^(\d{8} \d\d:\d\d:\d\d) (\w+) (\w+) (\w+) (\S+) (.*)$/,
> fields => [ qw( date host facility level program message ) ],
> datefmt => "%Y%m%d %H:%M:%S",
> );
Ah oui, match c'est une regexp qui découpe les champs "standard" dans la
ligne de log, fields, c'est les noms de ces champs dans l'ordre de la
capture et datefmt sert à convertir la date en un format interne.
--
Philippe "BooK" Bruhat
The faster the climb, the swifter the fall.
(Moral from Groo The Wanderer #87 (Epic))