<commit_before>/*-
 * Copyright (c) 2006 Verdens Gang AS
 * Copyright (c) 2006-2015 Varnish Software AS
 * All rights reserved.
 *
 * Author: <NAME> <<EMAIL>>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * Define the tags in the shared memory in a reusable format.
 * Whoever includes this get to define what the SLTM macro does.
 *
 * REMEMBER to update the documentation (especially the varnishlog(1) man
 * page) whenever this list changes.
 *
 * XXX: Please add new entries a the end to not break saved log-segments.
 * XXX: we can resort them when we have a major release.
 *
 * Arguments:
 *	Tag-Name
 *	Flags
 *	Short Description (1 line, max ? chars)
 *	Long Description (in RST "definition list" format)
 */

/*lint -save -e525 -e539 */

#define NODEF_NOTICE \
    "NB: This log record is masked by default.\n\n"

SLTM(Debug, SLT_F_BINARY, "Debug messages",
	"Debug messages can normally be ignored, but are sometimes"
	" helpful during trouble-shooting.  Most debug messages must"
	" be explicitly enabled with parameters.\n\n"
)

SLTM(Error, 0, "Error messages",
	"Error messages are stuff you probably want to know.\n\n"
)

SLTM(CLI, 0, "CLI communication",
	"CLI communication between varnishd master and child process.\n\n"
)

/*---------------------------------------------------------------------*/

SLTM(SessOpen, 0, "Client connection opened",
	"The first record for a client connection, with the socket-endpoints"
	" of the connection.\n\n"
	"The format is::\n\n"
	"\t%s %d %s %s %s %d\n"
	"\t|  |  |  |  |  |\n"
	"\t|  |  |  |  |  +- File descriptor number\n"
	"\t|  |  |  |  +---- Local TCP port\n"
	"\t|  |  |  +------- Local IPv4/6 address\n"
	"\t|  |  +---------- Listen socket (-a argument)\n"
	"\t|  +------------- Remote TCP port\n"
	"\t+---------------- Remote IPv4/6 address\n"
	"\n"
)

SLTM(SessClose, 0, "Client connection closed",
	"SessClose is the last record for any client connection.\n\n"
	"The format is::\n\n"
	"\t%s %f\n"
	"\t|  |\n"
	"\t|  +- How long the session was open\n"
	"\t+---- Why the connection closed\n"
	"\n"
)

/*---------------------------------------------------------------------*/

SLTM(BackendOpen, 0, "Backend connection opened",
	"Logged when a new backend connection is opened.\n\n"
	"The format is::\n\n"
	"\t%d %s %s %s %s %s\n"
	"\t|  |  |  |  |  |\n"
	"\t|  |  |  |  |  +- Local port\n"
	"\t|  |  |  |  +---- Local address\n"
	"\t|  |  |  +------- Remote port\n"
	"\t|  |  +---------- Remote address\n"
	"\t|  +------------- Backend display name\n"
	"\t+---------------- Connection file descriptor\n"
	"\n"
)

SLTM(BackendReuse, 0, "Backend connection put up for reuse",
	"Logged when a backend connection is put up for reuse by a later"
	" connection.\n\n"
	"The format is::\n\n"
	"\t%d %s\n"
	"\t|  |\n"
	"\t|  +- Backend display name\n"
	"\t+---- Connection file descriptor\n"
	"\n"
)

SLTM(BackendClose, 0, "Backend connection closed",
	"Logged when a backend connection is closed.\n\n"
	"The format is::\n\n"
	"\t%d %s [ %s ]\n"
	"\t|  |    |\n"
	"\t|  |    +- Optional reason\n"
	"\t|  +------ Backend display name\n"
	"\t+--------- Connection file descriptor\n"
	"\n"
)

SLTM(HttpGarbage, SLT_F_BINARY, "Unparseable HTTP request",
	"Logs the content of unparseable HTTP requests.\n\n"
)

SLTM(Proxy, 0, "PROXY protocol information",
	"PROXY protocol information.\n\n"
	"The format is::\n\n"
	"\t%d %s %d %s %d\n"
	"\t|  |  |  |  |\n"
	"\t|  |  |  |  +- server port\n"
	"\t|  |  |  +---- server ip\n"
	"\t|  |  +------- client port\n"
	"\t|  +---------- client ip\n"
	"\t+------------- PROXY protocol version\n"
	"\n"
)

SLTM(ProxyGarbage, 0, "Unparseable PROXY request",
	"A PROXY protocol header was unparseable.\n\n"
)

SLTM(Backend, 0, "Backend selected",
	"Logged when a connection is selected for handling a backend"
	" request.\n\n"
	"The format is::\n\n"
	"\t%d %s %s\n"
	"\t|  |  |\n"
	"\t|  |  +- Backend display name\n"
	"\t|  +---- VCL name\n"
	"\t+------- Connection file descriptor\n"
	"\n"
)

SLTM(Length, 0, "Size of object body",
	"Logs the size of a fetch object body.\n\n"
)

SLTM(FetchError, 0, "Error while fetching object",
	"Logs the error message of a failed fetch operation.\n\n"
)

#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
	SLTM(Req##tag, (req ? 0 : SLT_F_UNUSED), "Client request " sdesc, ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH

#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
	SLTM(Resp##tag, (resp ? 0 : SLT_F_UNUSED), "Client response " sdesc, \
	    ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH

#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
	SLTM(Bereq##tag, (req ? 0 : SLT_F_UNUSED), "Backend request " sdesc, \
	    ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH

#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
	SLTM(Beresp##tag, (resp ? 0 : SLT_F_UNUSED), "Backend response " \
	    sdesc, ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH

#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
	SLTM(Obj##tag, (resp ? 0 : SLT_F_UNUSED), "Object  " sdesc, ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH

SLTM(BogoHeader, 0, "Bogus HTTP received",
	"Contains the first 20 characters of received HTTP headers we could"
	" not make sense of.  Applies to both req.http and beresp.http.\n\n"
)

SLTM(LostHeader, 0, "Failed attempt to set HTTP header",
	"Logs the header name of a failed HTTP header operation due to"
	" resource exhaustion or configured limits.\n\n"
)

SLTM(TTL, 0, "TTL set on object",
	"A TTL record is emitted whenever the ttl, grace or keep"
	" values for an object is set.\n\n"
	"The format is::\n\n"
	"\t%s %d %d %d %d [ %d %d %u %u ]\n"
	"\t|  |  |  |  |    |  |  |  |\n"
	"\t|  |  |  |  |    |  |  |  +- Max-Age from Cache-Control header\n"
	"\t|  |  |  |  |    |  |  +---- Expires header\n"
	"\t|  |  |  |  |    |  +------- Date header\n"
	"\t|  |  |  |  |    +---------- Age (incl Age: header value)\n"
	"\t|  |  |  |  +--------------- Reference time for TTL\n"
	"\t|  |  |  +------------------ Keep\n"
	"\t|  |  +--------------------- Grace\n"
	"\t|  +------------------------ TTL\n"
	"\t+--------------------------- \"RFC\", \"VCL\" or \"HFP\"\n"
	"\n"
	"The last four fields are only present in \"RFC\" headers.\n\n"
	"Examples::\n\n"
	"\tRFC 60 10 -1 1312966109 1312966109 1312966109 0 60\n"
	"\tVCL 120 10 0 1312966111\n"
	"\n"
)

SLTM(Fetch_Body, 0, "Body fetched from backend",
	"Ready to fetch body from backend.\n\n"
	"The format is::\n\n"
	"\t%d (%s) %s\n"
	"\t|   |    |\n"
	"\t|   |    +---- 'stream' or '-'\n"
	"\t|   +--------- Text description of body fetch mode\n"
	"\t+------------- Body fetch mode\n"
	"\n"<commit_msg>Add an HFP record example<commit_after>/*-
 * Copyright (c) 2006 Verdens Gang AS
 * Copyright (c) 2006-2015 Varnish Software AS
 * All rights reserved.
 *
 * Author: <NAME> <<EMAIL>>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * Define the tags in the shared memory in a reusable format.
 * Whoever includes this get to define what the SLTM macro does.
 *
 * REMEMBER to update the documentation (especially the varnishlog(1) man
 * page) whenever this list changes.
 *
 * XXX: Please add new entries a the end to not break saved log-segments.
 * XXX: we can resort them when we have a major release.
 *
 * Arguments:
 *	Tag-Name
 *	Flags
 *	Short Description (1 line, max ? chars)
 *	Long Description (in RST "definition list" format)
 */

/*lint -save -e525 -e539 */

#define NODEF_NOTICE \
    "NB: This log record is masked by default.\n\n"

SLTM(Debug, SLT_F_BINARY, "Debug messages",
	"Debug messages can normally be ignored, but are sometimes"
	" helpful during trouble-shooting.  Most debug messages must"
	" be explicitly enabled with parameters.\n\n"
)

SLTM(Error, 0, "Error messages",
	"Error messages are stuff you probably want to know.\n\n"
)

SLTM(CLI, 0, "CLI communication",
	"CLI communication between varnishd master and child process.\n\n"
)

/*---------------------------------------------------------------------*/

SLTM(SessOpen, 0, "Client connection opened",
	"The first record for a client connection, with the socket-endpoints"
	" of the connection.\n\n"
	"The format is::\n\n"
	"\t%s %d %s %s %s %d\n"
	"\t|  |  |  |  |  |\n"
	"\t|  |  |  |  |  +- File descriptor number\n"
	"\t|  |  |  |  +---- Local TCP port\n"
	"\t|  |  |  +------- Local IPv4/6 address\n"
	"\t|  |  +---------- Listen socket (-a argument)\n"
	"\t|  +------------- Remote TCP port\n"
	"\t+---------------- Remote IPv4/6 address\n"
	"\n"
)

SLTM(SessClose, 0, "Client connection closed",
	"SessClose is the last record for any client connection.\n\n"
	"The format is::\n\n"
	"\t%s %f\n"
	"\t|  |\n"
	"\t|  +- How long the session was open\n"
	"\t+---- Why the connection closed\n"
	"\n"
)

/*---------------------------------------------------------------------*/

SLTM(BackendOpen, 0, "Backend connection opened",
	"Logged when a new backend connection is opened.\n\n"
	"The format is::\n\n"
	"\t%d %s %s %s %s %s\n"
	"\t|  |  |  |  |  |\n"
	"\t|  |  |  |  |  +- Local port\n"
	"\t|  |  |  |  +---- Local address\n"
	"\t|  |  |  +------- Remote port\n"
	"\t|  |  +---------- Remote address\n"
	"\t|  +------------- Backend display name\n"
	"\t+---------------- Connection file descriptor\n"
	"\n"
)

SLTM(BackendReuse, 0, "Backend connection put up for reuse",
	"Logged when a backend connection is put up for reuse by a later"
	" connection.\n\n"
	"The format is::\n\n"
	"\t%d %s\n"
	"\t|  |\n"
	"\t|  +- Backend display name\n"
	"\t+---- Connection file descriptor\n"
	"\n"
)

SLTM(BackendClose, 0, "Backend connection closed",
	"Logged when a backend connection is closed.\n\n"
	"The format is::\n\n"
	"\t%d %s [ %s ]\n"
	"\t|  |    |\n"
	"\t|  |    +- Optional reason\n"
	"\t|  +------ Backend display name\n"
	"\t+--------- Connection file descriptor\n"
	"\n"
)

SLTM(HttpGarbage, SLT_F_BINARY, "Unparseable HTTP request",
	"Logs the content of unparseable HTTP requests.\n\n"
)

SLTM(Proxy, 0, "PROXY protocol information",
	"PROXY protocol information.\n\n"
	"The format is::\n\n"
	"\t%d %s %d %s %d\n"
	"\t|  |  |  |  |\n"
	"\t|  |  |  |  +- server port\n"
	"\t|  |  |  +---- server ip\n"
	"\t|  |  +------- client port\n"
	"\t|  +---------- client ip\n"
	"\t+------------- PROXY protocol version\n"
	"\n"
)

SLTM(ProxyGarbage, 0, "Unparseable PROXY request",
	"A PROXY protocol header was unparseable.\n\n"
)

SLTM(Backend, 0, "Backend selected",
	"Logged when a connection is selected for handling a backend"
	" request.\n\n"
	"The format is::\n\n"
	"\t%d %s %s\n"
	"\t|  |  |\n"
	"\t|  |  +- Backend display name\n"
	"\t|  +---- VCL name\n"
	"\t+------- Connection file descriptor\n"
	"\n"
)

SLTM(Length, 0, "Size of object body",
	"Logs the size of a fetch object body.\n\n"
)

SLTM(FetchError, 0, "Error while fetching object",
	"Logs the error message of a failed fetch operation.\n\n"
)

#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
	SLTM(Req##tag, (req ? 0 : SLT_F_UNUSED), "Client request " sdesc, ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH

#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
	SLTM(Resp##tag, (resp ? 0 : SLT_F_UNUSED), "Client response " sdesc, \
	    ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH

#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
	SLTM(Bereq##tag, (req ? 0 : SLT_F_UNUSED), "Backend request " sdesc, \
	    ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH

#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
	SLTM(Beresp##tag, (resp ? 0 : SLT_F_UNUSED), "Backend response " \
	    sdesc, ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH

#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
	SLTM(Obj##tag, (resp ? 0 : SLT_F_UNUSED), "Object  " sdesc, ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH

SLTM(BogoHeader, 0, "Bogus HTTP received",
	"Contains the first 20 characters of received HTTP headers we could"
	" not make sense of.  Applies to both req.http and beresp.http.\n\n"
)

SLTM(LostHeader, 0, "Failed attempt to set HTTP header",
	"Logs the header name of a failed HTTP header operation due to"
	" resource exhaustion or configured limits.\n\n"
)

SLTM(TTL, 0, "TTL set on object",
	"A TTL record is emitted whenever the ttl, grace or keep"
	" values for an object is set.\n\n"
	"The format is::\n\n"
	"\t%s %d %d %d %d [ %d %d %u %u ]\n"
	"\t|  |  |  |  |    |  |  |  |\n"
	"\t|  |  |  |  |    |  |  |  +- Max-Age from Cache-Control header\n"
	"\t|  |  |  |  |    |  |  +---- Expires header\n"
	"\t|  |  |  |  |    |  +------- Date header\n"
	"\t|  |  |  |  |    +---------- Age (incl Age: header value)\n"
	"\t|  |  |  |  +--------------- Reference time for TTL\n"
	"\t|  |  |  +------------------ Keep\n"
	"\t|  |  +--------------------- Grace\n"
	"\t|  +------------------------ TTL\n"
	"\t+--------------------------- \"RFC\", \"VCL\" or \"HFP\"\n"
	"\n"
	"The last four fields are only present in \"RFC\" headers.\n\n"
	"Examples::\n\n"
	"\tRFC 60 10 -1 1312966109 1312966109 1312966109 0 60\n"
	"\tVCL 120 10 0 1312966111\n"
	"\tHFP 2 0 0 1312966113\n"
	"\n"
)

SLTM(Fetch_Body, 0, "Body fetched from backend",
	"Ready to fetch body from backend.\n\n"
	"The format is::\n\n"
	"\t%d (%s) %s\n"
	"\t|   |    |\n"
	"\t|   |    +---- 'stream' or '-'\n"
	"\t|   +--------- Text description of body fetch mode\n"
	"\t+------------- Body fetch mode\n"
	"\n"
{'fraction_non_alphanumeric': 0.19966933740302684, 'fraction_numerical': 0.013925982449446777, 'mean_word_length': 2.4956657034896645, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2845161', 'n_tokens_mistral': 5976, 'n_tokens_neox': 5665, 'n_words': 1902}