On 2007-08-29 09:08:56 -0700, JT Moree wrote:
> > If you leave out any of the local info, an installation with two
> > servers with un-synced times could still gen the same id. if you add
> > it, then the only way you could have a collision is if your time is
> > not granular enough or gets set back.
> 
> I'm ok with that
> 
>  Using HiRes::Time
> 
> my $lip = $conn->local_ip();

    up to 15 characters (39 with IPv6)

> my $rip = $conn->remote_ip();

    up to 15 characters (39 with IPv6)

> my $rport = $conn->remote_port || "0";

    up to 5 characters

> my $lport = $conn->local_port || "0";

    up to 5 characters

> my $start = time;

    up to 16 characters

$$

    up to 5 characters (10 for 32bit PIDs)

> my $id = "$$_$start_$lip:$lport_$rip:$rport";

    5 + 1 + 16 + 1 + 15 + 1 + 5 + 1 + 15 + 1 + 5 = 66 characters

or even

    10 + 1 + 16 + 1 + 39 + 1 + 5 + 1 + 39 + 1 + 5 = 119 characters

on some systems. Much too long for an ID which is included in each log
line. You could condense it by using base 36 instead of base 10, but
it's still quite bulky.

        hp


-- 
   _  | Peter J. Holzer    | I know I'd be respectful of a pirate 
|_|_) | Sysadmin WSR       | with an emu on his shoulder.
| |   | [EMAIL PROTECTED]         |
__/   | http://www.hjp.at/ |    -- Sam in "Freefall"

Attachment: signature.asc
Description: Digital signature

Reply via email to