MINOR: log: allow the HTTP status code to be logged even in TCP frontends
authorWilly Tarreau <w@1wt.eu>
Fri, 13 Jun 2014 10:21:40 +0000 (12:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 13 Jun 2014 14:32:48 +0000 (16:32 +0200)
Log format is defined in the frontend, and some frontends may be chained to
an HTTP backend. Sometimes it's very convenient to be able to log the HTTP
status code of these HTTP backends. This status is definitely present in
the internal structures, it's just that we used to limit it to be used in
HTTP frontends. So let's simply relax the check to allow it to be used in
TCP frontends as well.

doc/configuration.txt
src/log.c

index 334aded..c16137d 100644 (file)
@@ -12076,7 +12076,7 @@ Please refer to the table below for currently defined variables :
   | H | %CS  | captured_response_cookie                      | string      |
   |   | %H   | hostname                                      | string      |
   |   | %ID  | unique-id                                     | string      |
-  | H | %ST  | status_code                                   | numeric     |
+  |   | %ST  | status_code                                   | numeric     |
   |   | %T   | gmt_date_time                                 | date        |
   |   | %Tc  | Tc                                            | numeric     |
   |   | %Tl  | local_date_time                               | date        |
index efb3d27..392256f 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -80,7 +80,7 @@ static const struct logformat_type logformat_keywords[] = {
        { "CS", LOG_FMT_CSERVER, PR_MODE_HTTP, LW_RSPHDR, NULL },  /* server cookie */
        { "H", LOG_FMT_HOSTNAME, PR_MODE_TCP, LW_INIT, NULL }, /* Hostname */
        { "ID", LOG_FMT_UNIQUEID, PR_MODE_HTTP, LW_BYTES, NULL }, /* Unique ID */
-       { "ST", LOG_FMT_STATUS, PR_MODE_HTTP, LW_RESP, NULL },   /* status code */
+       { "ST", LOG_FMT_STATUS, PR_MODE_TCP, LW_RESP, NULL },   /* status code */
        { "T", LOG_FMT_DATEGMT, PR_MODE_TCP, LW_INIT, NULL },   /* date GMT */
        { "Tc", LOG_FMT_TC, PR_MODE_TCP, LW_BYTES, NULL },       /* Tc */
        { "Tl", LOG_FMT_DATELOCAL, PR_MODE_TCP, LW_INIT, NULL },   /* date local timezone */