Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx log format - remove space after a variable

Here's an example Nginx log format:

  log_format mylog '$request $request_time ms'

which will show something like GET /foo 10 ms and would be nicer if it showed GET /foo 10ms

Is there any way to remove the space after the $request_time variable. e.g. something like bash's ${request_time}ms.

like image 548
mahemoff Avatar asked Mar 26 '26 16:03

mahemoff


1 Answers

To my surprise, the bash style actually works 😊

 log_format mylog '$request ${request_time}ms'
like image 131
mahemoff Avatar answered Mar 31 '26 08:03

mahemoff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!