mirror of
https://github.com/haproxy/haproxy.git
synced 2026-03-09 09:30:46 -04:00
Until now it was not possible to know from the logs whether the incoming connection was made over SSL or not. In order to address this in the existing log formats, a new log format %ft was introduced, to log the frontend's name suffixed with its transport layer. The only transport layer in use right now is '~' for SSL, so that existing log formats for non-SSL traffic are not affected at all, and SSL log formats have the frontend's name suffixed with '~'. The TCP, HTTP and CLF log format now use %ft instead of %f. This does not affect existing log formats which still make use of %f however.
150 lines
3.3 KiB
C
150 lines
3.3 KiB
C
/*
|
|
include/types/log.h
|
|
This file contains definitions of log-related structures and macros.
|
|
|
|
Copyright (C) 2000-2006 Willy Tarreau - w@1wt.eu
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation, version 2.1
|
|
exclusively.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with this library; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#ifndef _TYPES_LOG_H
|
|
#define _TYPES_LOG_H
|
|
|
|
#include <sys/socket.h>
|
|
#include <sys/un.h>
|
|
#include <netinet/in.h>
|
|
#include <common/config.h>
|
|
#include <common/mini-clist.h>
|
|
|
|
#define MAX_SYSLOG_LEN 1024
|
|
#define NB_LOG_FACILITIES 24
|
|
#define NB_LOG_LEVELS 8
|
|
#define SYSLOG_PORT 514
|
|
#define UNIQUEID_LEN 128
|
|
|
|
|
|
/* lists of fields that can be logged */
|
|
enum {
|
|
|
|
LOG_FMT_TEXT = 0, /* raw text */
|
|
|
|
LOG_FMT_SEPARATOR, /* separator replaced by one space */
|
|
LOG_FMT_VARIABLE,
|
|
|
|
/* information fields */
|
|
LOG_FMT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, // { and within { }
|
|
LF_EDARG, // end arg }
|
|
};
|
|
|
|
|
|
struct logformat_node {
|
|
struct list list;
|
|
int type;
|
|
int options;
|
|
char *arg;
|
|
};
|
|
|
|
#define LOG_OPT_HEXA 0x00000001
|
|
#define LOG_OPT_MANDATORY 0x00000002
|
|
#define LOG_OPT_QUOTE 0x00000004
|
|
|
|
|
|
|
|
/* fields that need to be logged. They appear as flags in session->logs.logwait */
|
|
#define LW_INIT 1 /* date */
|
|
#define LW_CLIP 2 /* CLient IP */
|
|
#define LW_SVIP 4 /* SerVer IP */
|
|
#define LW_SVID 8 /* server ID */
|
|
#define LW_REQ 16 /* http REQuest */
|
|
#define LW_RESP 32 /* http RESPonse */
|
|
#define LW_BYTES 256 /* bytes read from server */
|
|
#define LW_COOKIE 512 /* captured cookie */
|
|
#define LW_REQHDR 1024 /* request header(s) */
|
|
#define LW_RSPHDR 2048 /* response header(s) */
|
|
#define LW_BCKIP 4096 /* backend IP */
|
|
#define LW_FRTIP 8192 /* frontend IP */
|
|
|
|
struct logsrv {
|
|
struct list list;
|
|
struct sockaddr_storage addr;
|
|
int facility;
|
|
int level;
|
|
int minlvl;
|
|
};
|
|
|
|
#endif /* _TYPES_LOG_H */
|
|
|
|
/*
|
|
* Local variables:
|
|
* c-indent-level: 8
|
|
* c-basic-offset: 8
|
|
* End:
|
|
*/
|