blob: 2f11aabb7f88254b58dd537003a29c610c16fc74 [file] [log] [blame]
Willy Tarreaubaaee002006-06-26 02:48:02 +02001/*
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 Tarreau019767b2007-12-05 11:11:55 +010025#include <sys/socket.h>
Robert Tsai81ae1952007-12-05 10:47:29 +010026#include <sys/un.h>
27#include <netinet/in.h>
Willy Tarreaue3ba5f02006-06-29 18:54:54 +020028#include <common/config.h>
Willy Tarreaubaaee002006-06-26 02:48:02 +020029
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 Lallemand723b73a2012-02-08 16:37:49 +010035/* lists of fields that can be logged */
36enum {
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 Lallemandb7ff6a32012-03-02 14:35:21 +010047 LOG_SOURCEPORT,
48 LOG_SOURCEIP,
William Lallemand723b73a2012-02-08 16:37:49 +010049 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,
66 LOG_CONN,
67 LOG_ACTCONN,
68 LOG_FECONN,
69 LOG_BECONN,
70 LOG_SRVCONN,
71 LOG_RETRIES,
72 LOG_QUEUES,
73 LOG_SRVQUEUE,
74 LOG_BCKQUEUE,
75 LOG_HDRREQUEST,
76 LOG_HDRRESPONS,
77 LOG_HDRREQUESTLIST,
78 LOG_HDRRESPONSLIST,
79 LOG_REQ,
80};
81
82/* enum for parse_logformat */
83enum {
84 LF_TEXT = 0,
85 LF_SEPARATOR,
86 LF_VAR, // after %
87
88 LF_STARTVAR, // %
89 LF_STARG, // { and within { }
90 LF_EDARG, // end arg }
91};
92
93
94struct logformat_node {
95 struct list list;
96 int type;
97 int options;
98 char *arg;
99};
100
101#define LOG_OPT_WRITTEN 0x00000001
102#define LOG_OPT_MANDATORY 0x00000002
103#define LOG_OPT_QUOTE 0x00000004
104
105
Willy Tarreaubaaee002006-06-26 02:48:02 +0200106
107/* fields that need to be logged. They appear as flags in session->logs.logwait */
108#define LW_DATE 1 /* date */
109#define LW_CLIP 2 /* CLient IP */
110#define LW_SVIP 4 /* SerVer IP */
111#define LW_SVID 8 /* server ID */
112#define LW_REQ 16 /* http REQuest */
113#define LW_RESP 32 /* http RESPonse */
114#define LW_PXIP 64 /* proxy IP */
115#define LW_PXID 128 /* proxy ID */
116#define LW_BYTES 256 /* bytes read from server */
117#define LW_COOKIE 512 /* captured cookie */
118#define LW_REQHDR 1024 /* request header(s) */
119#define LW_RSPHDR 2048 /* response header(s) */
120
Robert Tsai81ae1952007-12-05 10:47:29 +0100121struct logsrv {
William Lallemand0f99e342011-10-12 17:50:54 +0200122 struct list list;
David du Colombier11bcb6c2011-03-24 12:23:00 +0100123 struct sockaddr_storage addr;
William Lallemand0f99e342011-10-12 17:50:54 +0200124 int facility;
125 int level;
126 int minlvl;
Robert Tsai81ae1952007-12-05 10:47:29 +0100127};
128
Willy Tarreaubaaee002006-06-26 02:48:02 +0200129#endif /* _TYPES_LOG_H */
130
131/*
132 * Local variables:
133 * c-indent-level: 8
134 * c-basic-offset: 8
135 * End:
136 */