Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 1 | /* |
| 2 | include/types/log.h |
| 3 | This file contains definitions of log-related structures and macros. |
| 4 | |
| 5 | Copyright (C) 2000-2006 Willy Tarreau - w@1wt.eu |
| 6 | |
| 7 | This library is free software; you can redistribute it and/or |
| 8 | modify it under the terms of the GNU Lesser General Public |
| 9 | License as published by the Free Software Foundation, version 2.1 |
| 10 | exclusively. |
| 11 | |
| 12 | This library is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | Lesser General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU Lesser General Public |
| 18 | License along with this library; if not, write to the Free Software |
| 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | #ifndef _TYPES_LOG_H |
| 23 | #define _TYPES_LOG_H |
| 24 | |
Willy Tarreau | 019767b | 2007-12-05 11:11:55 +0100 | [diff] [blame] | 25 | #include <sys/socket.h> |
Robert Tsai | 81ae195 | 2007-12-05 10:47:29 +0100 | [diff] [blame] | 26 | #include <sys/un.h> |
| 27 | #include <netinet/in.h> |
Willy Tarreau | e3ba5f0 | 2006-06-29 18:54:54 +0200 | [diff] [blame] | 28 | #include <common/config.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 29 | |
| 30 | #define MAX_SYSLOG_LEN 1024 |
| 31 | #define NB_LOG_FACILITIES 24 |
| 32 | #define NB_LOG_LEVELS 8 |
| 33 | #define SYSLOG_PORT 514 |
| 34 | |
William Lallemand | 723b73a | 2012-02-08 16:37:49 +0100 | [diff] [blame] | 35 | /* lists of fields that can be logged */ |
| 36 | enum { |
| 37 | |
| 38 | LOG_TEXT = 0, /* raw text */ |
| 39 | |
| 40 | LOG_SEPARATOR, /* separator replaced by one space */ |
| 41 | LOG_VARIABLE, |
| 42 | |
| 43 | /* information fields */ |
| 44 | LOG_GLOBAL, |
| 45 | LOG_CLIENTIP, |
| 46 | LOG_CLIENTPORT, |
William Lallemand | b7ff6a3 | 2012-03-02 14:35:21 +0100 | [diff] [blame] | 47 | LOG_SOURCEPORT, |
| 48 | LOG_SOURCEIP, |
William Lallemand | 723b73a | 2012-02-08 16:37:49 +0100 | [diff] [blame] | 49 | LOG_DATE, |
| 50 | LOG_DATEGMT, |
| 51 | LOG_MS, |
| 52 | LOG_FRONTEND, |
| 53 | LOG_BACKEND, |
| 54 | LOG_SERVER, |
| 55 | LOG_BYTES, |
| 56 | LOG_T, |
| 57 | LOG_TQ, |
| 58 | LOG_TW, |
| 59 | LOG_TC, |
| 60 | LOG_TR, |
| 61 | LOG_TT, |
| 62 | LOG_STATUS, |
| 63 | LOG_CCLIENT, |
| 64 | LOG_CSERVER, |
| 65 | LOG_TERMSTATE, |
Willy Tarreau | 6580c06 | 2012-03-12 15:09:42 +0100 | [diff] [blame] | 66 | LOG_TERMSTATE_CK, |
William Lallemand | 723b73a | 2012-02-08 16:37:49 +0100 | [diff] [blame] | 67 | LOG_CONN, |
| 68 | LOG_ACTCONN, |
| 69 | LOG_FECONN, |
| 70 | LOG_BECONN, |
| 71 | LOG_SRVCONN, |
| 72 | LOG_RETRIES, |
| 73 | LOG_QUEUES, |
| 74 | LOG_SRVQUEUE, |
| 75 | LOG_BCKQUEUE, |
| 76 | LOG_HDRREQUEST, |
| 77 | LOG_HDRRESPONS, |
| 78 | LOG_HDRREQUESTLIST, |
| 79 | LOG_HDRRESPONSLIST, |
| 80 | LOG_REQ, |
| 81 | }; |
| 82 | |
| 83 | /* enum for parse_logformat */ |
| 84 | enum { |
| 85 | LF_TEXT = 0, |
| 86 | LF_SEPARATOR, |
| 87 | LF_VAR, // after % |
| 88 | |
| 89 | LF_STARTVAR, // % |
| 90 | LF_STARG, // { and within { } |
| 91 | LF_EDARG, // end arg } |
| 92 | }; |
| 93 | |
| 94 | |
| 95 | struct logformat_node { |
| 96 | struct list list; |
| 97 | int type; |
| 98 | int options; |
| 99 | char *arg; |
| 100 | }; |
| 101 | |
| 102 | #define LOG_OPT_WRITTEN 0x00000001 |
| 103 | #define LOG_OPT_MANDATORY 0x00000002 |
| 104 | #define LOG_OPT_QUOTE 0x00000004 |
| 105 | |
| 106 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 107 | |
| 108 | /* fields that need to be logged. They appear as flags in session->logs.logwait */ |
| 109 | #define LW_DATE 1 /* date */ |
| 110 | #define LW_CLIP 2 /* CLient IP */ |
| 111 | #define LW_SVIP 4 /* SerVer IP */ |
| 112 | #define LW_SVID 8 /* server ID */ |
| 113 | #define LW_REQ 16 /* http REQuest */ |
| 114 | #define LW_RESP 32 /* http RESPonse */ |
| 115 | #define LW_PXIP 64 /* proxy IP */ |
| 116 | #define LW_PXID 128 /* proxy ID */ |
| 117 | #define LW_BYTES 256 /* bytes read from server */ |
| 118 | #define LW_COOKIE 512 /* captured cookie */ |
| 119 | #define LW_REQHDR 1024 /* request header(s) */ |
| 120 | #define LW_RSPHDR 2048 /* response header(s) */ |
| 121 | |
Robert Tsai | 81ae195 | 2007-12-05 10:47:29 +0100 | [diff] [blame] | 122 | struct logsrv { |
William Lallemand | 0f99e34 | 2011-10-12 17:50:54 +0200 | [diff] [blame] | 123 | struct list list; |
David du Colombier | 11bcb6c | 2011-03-24 12:23:00 +0100 | [diff] [blame] | 124 | struct sockaddr_storage addr; |
William Lallemand | 0f99e34 | 2011-10-12 17:50:54 +0200 | [diff] [blame] | 125 | int facility; |
| 126 | int level; |
| 127 | int minlvl; |
Robert Tsai | 81ae195 | 2007-12-05 10:47:29 +0100 | [diff] [blame] | 128 | }; |
| 129 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 130 | #endif /* _TYPES_LOG_H */ |
| 131 | |
| 132 | /* |
| 133 | * Local variables: |
| 134 | * c-indent-level: 8 |
| 135 | * c-basic-offset: 8 |
| 136 | * End: |
| 137 | */ |