Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Is there an equivalent to %D or %T which shows the total request time in milliseconds instead of microseconds or seconds?

The rest of our systems (DB and app servers) usually log request times in milliseconds. Is there a way to log Apache's request time in milliseconds so that all of our servers log using the same unit of time?

EDIT: I want to know the total number of milliseconds that a request takes. I can see the documentation for setting the timestamp - which is not what I am looking for.

share|improve this question

closed as off-topic by Jenny D, Rex, MichelZ, Wesley, mdpc Apr 17 '14 at 22:27

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Jenny D, Rex, MichelZ, Wesley
If this question can be reworded to fit the rules in the help center, please edit the question.

2 tells you how. – Jenny D Apr 17 '14 at 15:51
@jenny - I don't see anything in that documentation that tells me how to do what I asked. But I can see how you are confused because "time" is ambiguous. – nimblegorilla Apr 17 '14 at 16:33
Yes, divide by 1000. – Michael Hampton Apr 17 '14 at 17:40
Michael - how do I divide %D by 1000 in the log file? I didn't realize it was possible to do math expressions. – nimblegorilla Apr 17 '14 at 18:34
You do it with your log analysis tools after the logs are written. If you can't do that, then you write a script to convert the logs before sending your analysis tools on them. If neither of those are acceptable, you're going to have to write a patch for apache (or hire someone to write one) or give up. – yoonix Apr 17 '14 at 19:41

1 Answer 1

You can. Take a look at the docs here

share|improve this answer
That only tells me the timestamp in milliseconds, but I am looking for the measurement of the amount of time the request took. – nimblegorilla Apr 17 '14 at 16:33
You can't time requests as a log output as far as I know. What you may need to do is handle that in your application code, and log that from your app separately. – kalikid021 Apr 17 '14 at 17:19
I'm already using %D to time the requests in microseconds so it is definitely possible. You can also use %T for time in seconds. The only thing I can't find is a way to log in milliseconds. – nimblegorilla Apr 17 '14 at 18:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.