Skip to content

Commit

Permalink
use microseconds for request_duration, to be consistent with mod_log_…
Browse files Browse the repository at this point in the history
…config
  • Loading branch information
Marius Sturm committed Apr 7, 2016
1 parent 4da9aec commit b663979
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions README.md
Expand Up @@ -81,6 +81,7 @@ What does the `GelfFields` string mean:
| C | Connection status |
| c | Extract Cookie |
| D | Request duration |
| | (in microseconds) |
| f | Requested file |
| H | Protocol |
| h | Remote host |
Expand Down Expand Up @@ -121,9 +122,7 @@ Bundle module and configuration files to system package, e.g. for Ubuntu:
Install dependent c libraries:

```
$ sudo apt-get install apache2-dev
$ sudo apt-get install libjson-c-dev
$ sudo apt-get install zlib1g-dev
$ sudo apt-get install apache2-dev libjson-c-dev zlib1g-dev
```

Compile and install modules:
Expand Down
2 changes: 1 addition & 1 deletion src/functions20.h
Expand Up @@ -85,7 +85,7 @@ static const char *extract_request_time(request_rec *r, char *a)
static const char *extract_request_duration(request_rec *r, char *a)
{
apr_time_t duration = apr_time_now() - r->request_time;
return apr_psprintf(r->pool, "%.3lf", apr_time_usec(duration)/1000.0);
return apr_psprintf(r->pool, "%ld", apr_time_usec(duration));
}

static const char *extract_connection_status(request_rec *r, char *a) __attribute__((unused));
Expand Down
2 changes: 1 addition & 1 deletion src/mod_log_gelf.c
Expand Up @@ -389,7 +389,7 @@ static int log_gelf_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *pte
log_gelf_register_item(server,p,'B', extract_bytes_sent, NULL, "_bytes_send");
log_gelf_register_item(server,p,'C', extract_connection_status, NULL, "_connection_status");
log_gelf_register_item(server,p,'c', extract_specific_cookie, config->cookie, "_cookie");
log_gelf_register_item(server,p,'D', extract_request_duration, NULL, "_request_duration_ms");
log_gelf_register_item(server,p,'D', extract_request_duration, NULL, "_request_duration_us");
log_gelf_register_item(server,p,'f', extract_request_file, NULL, "_request_file");
log_gelf_register_item(server,p,'H', extract_request_protocol, NULL, "_request_protocol");
log_gelf_register_item(server,p,'h', extract_remote_host, NULL, "_remote_host");
Expand Down

0 comments on commit b663979

Please sign in to comment.