[Oisf-devel] [PATCH] Added request length to custom HTTP logging

Victor Julien victor at inliniac.net
Thu Mar 28 09:37:10 UTC 2013


On 03/23/2013 10:46 AM, mathewm at sdf.lonestar.org wrote:
> Added request length to custom HTTP logging
> 
> Custom HTTP logging currently provides access to the HTTP response
> length (via %B in the custom log format string), but not the request
> length. The request length can be very valuable.
> 
> I've modified log-httplog.c to provide access to libhtp's
> request_message_len, via %b in the custom log format.

Interesting addition. Was going to apply it, but my git rejects it. Can
you retry sending it against the current master, or attach a "git
format-patch -1" file? A github pr works as well.

Cheers,
Victor

> ---
>  src/log-httplog.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/log-httplog.c b/src/log-httplog.c
> index f4c6b42..6db5432 100644
> --- a/src/log-httplog.c
> +++ b/src/log-httplog.c
> @@ -108,6 +108,7 @@ void TmModuleLogHttpLogIPv6Register (void) {
>  #define LOG_HTTP_CF_REQUEST_TIME 't'
>  #define LOG_HTTP_CF_REQUEST_HEADER 'i'
>  #define LOG_HTTP_CF_REQUEST_COOKIE 'C'
> +#define LOG_HTTP_CF_REQUEST_LEN 'b'
>  #define LOG_HTTP_CF_RESPONSE_STATUS 's'
>  #define LOG_HTTP_CF_RESPONSE_HEADER 'o'
>  #define LOG_HTTP_CF_RESPONSE_LEN 'B'
> @@ -264,6 +265,10 @@ static void LogHttpLogCustom(LogHttpLogThread *aft,
> htp_tx_t *tx, const struct t
>                      MemBufferWriteString(aft->buffer, LOG_HTTP_CF_NONE);
>                  }
>                  break;
> +            case LOG_HTTP_CF_REQUEST_LEN:
> +            /* REQUEST LEN */
> +                MemBufferWriteString(aft->buffer, "%"PRIuMAX"",
> (uintmax_t)tx->request_message_len);
> +                break;
>              case LOG_HTTP_CF_RESPONSE_STATUS:
>              /* RESPONSE STATUS */
>                  if (tx->response_status != NULL) {


-- 
---------------------------------------------
Victor Julien
http://www.inliniac.net/
PGP: http://www.inliniac.net/victorjulien.asc
---------------------------------------------




More information about the Oisf-devel mailing list