Forum Discussion

Asher_Hod_11473's avatar
Icon for Nimbostratus rankNimbostratus
Jul 12, 2015

does anyone know how to create guid in irule ?

hi , we want to monitor all the requests and response that comes to our services . we log those requests and we want to create for each request/response a unique guid . the guid is a standart guid that looks like this "47aa0474-f9b0-4d1e-a4e5-bdded684503e". it will be nice if someone try this and can share its knowledge .


Thanks Asher


1 Reply

  • Hi All , I have found this amd made a proc . It looks like its working

    proc cretaeGuid {

        append s [clock seconds] [IP::local_addr] [IP::client_addr] [expr { int(100000000 * rand()) }] [clock clicks] 
            set s [md5 $s] 
            binary scan $s c* s 
            lset s 8 [expr {([lindex $s 8] & 0x7F) | 0x40}] 
            lset s 6 [expr {([lindex $s 6] & 0x0F) | 0x40}] 
            set s [binary format c* $s] 
            binary scan $s H* s 
            append u [substr $s 0 8] "-" [substr $s 8 4] "-" [substr $s 12 4] "-" [substr $s 16 4] "-" [substr $s 20 12] 
            unset s
    return $u