Hey again,

I tried to use rand, but when using it, my generation code for a UUID looks 
like this: 

unique-id-format 
%[rand,hex,bytes(8,8),lower]-%[rand(65536),hex,bytes(12,4),lower]-4%[rand(4096),hex,bytes(13,3),lower]-%[rand(16384),add(32768),hex,bytes(12,4),lower]-%[rand(65536),hex,bytes(12,4),lower]%[rand,hex,bytes(8,8),lower]

To be honest I think for a simple UUID, we should not be required to but such a 
complicated and long line into the config. Also, I think that the performance 
impact of such a line is much bigger than the generation of a UUID in plain C 
code. We could just create a ACL generator called uuid or something similar 
which would do the job. The config would get much clearer.

Any opinions to this? I would be willing to implement such a feature if the 
maintainers would be ready to merge it in general.

Best regards
Luca

On 03.09.19, 10:34, "li...@ltri.eu on behalf of Lukas Tribus" <li...@ltri.eu> 
wrote:

    Hello Luca,
    
    On Tue, 3 Sep 2019 at 09:18, Schimweg, Luca <luca.schim...@sap.com> wrote:
    >
    > Hey,
    >
    >
    >
    > for one use case I have, I would need a variable like %uuid in 
log-formats,
    > which just generates a random UUID. The use-case would be, to be able
    > to set the unique-id-format to this uuid, so that we can have a random 
uuid
    > set as request-id for any incoming request. Right now, it’s quite 
difficult to
    > get a random and unique request-id, the random uuid approach would
    > definitely help with that.
    
    I assume the rand [1] does not suffice. In this case, I'd suggest to
    use LUA for this, maybe by using some library like lua-resty-jit-uuid
    [2].
    
    
    Lukas
    
    [1] https://cbonte.github.io/haproxy-dconv/1.9/configuration.html#7.3.2-rand
    [2] https://github.com/thibaultcha/lua-resty-jit-uuid
    

Reply via email to