Hi Jose, On Fri, Aug 07, 2015 at 01:28:13PM -0400, Jose Nunez wrote: > Hi, > > I need to express something similar to this: > > http-request set-header X-REQUEST-START t=%[Ts]%[ms]000 > > (to append three "0"s at the end of the timestamp with milliseconds). > > I have tried with other ways to append the three "0"s at the end: > > http-request set-header X-REQUEST-START t=%Ts%[ms]\x30\x30\x30 > > and > > http-request set-header X-REQUEST-START t=%Ts%ms\x30\x30\x30 > > and no avail either.
You've met the limits of the log format which is not a language and which requires some delimiters to be detected. Unfortunately it doesn't have any delimiter which doesn't appear in the output. I found a way to abuse it using %[] to mark a new word (since %[] detects the end of the current block using the closing bracket). Using just "%[]" emits a warning and does exactly what you want. A cleaner method in 1.6 consists in emitting an empty string as a delimitor : %[str()]. In 1.5, there is no str(), but you can use %[env()] which will retrieve the contents of the environment variable with no name, it doesn't exist so it returns an empty string. Yes I know that's ugly, but the log format has gone far beyond its design goals already! Thus it will give you this in 1.5 : http-request set-header X-REQUEST-START t=%Ts%ms%[env()]000 In 1.6 you can also do that : http-request set-header X-REQUEST-START t=%Ts%ms%[str(000)] Also, please note that what you're doing above only works because %ms is left-padded with zeroes. I'm not seeing this documented anywhere though. Willy