# Writing the total request time in seconds to an nginx access log, possibly using a calculated variab

**URL:** <https://www.ruby-forum.com/t/writing-the-total-request-time-in-seconds-to-an-nginx-access-log-possibly-using-a-calculated-variab/224287>\
**Category:** NGINX\
**Created:** [November 6, 2012, 11:32pm UTC](https://www.ruby-forum.com/t/writing-the-total-request-time-in-seconds-to-an-nginx-access-log-possibly-using-a-calculated-variab/224287 "2012-11-06T23:32:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [November 6, 2012, 11:32pm UTC](https://www.ruby-forum.com/t/writing-the-total-request-time-in-seconds-to-an-nginx-access-log-possibly-using-a-calculated-variab/224287/1 "2012-11-06T23:32:59Z")

</div>

I’m trying to modify my nginx access log format to include the request  
duration, in seconds.

I see two possible variables I could use:

1. $request\_time ([http://wiki.nginx.org/HttpLogModule#log\_format](http://wiki.nginx.org/HttpLogModule#log_format))

2. $upstream\_response\_time  
([http://wiki.nginx.org/NginxHttpUpstreamModule#.24upstream\_response\_time](http://wiki.nginx.org/NginxHttpUpstreamModule#.24upstream_response_time))

However both of these variables are expressed in microseconds, and I  
need  
this value to be rendered in seconds. Is there any way to specify the  
output  
as an expression (i.e. $request\_time \* 1000) or accomplish this in some  
other way?

Thanks,  
Tharsan

Posted at Nginx Forum:

> **[Writing the total request time in seconds to an nginx access log, possibly...](https://forum.nginx.org/read.php?2,232547,232547#msg-232547)**
>
> I'm trying to modify my nginx access log format to include the request duration, in seconds. I see two possible variables I could use: 1) $request\_time (http://wiki.nginx.org/HttpLogModule#log\_format) 2) $upstream\_response\_time...
