blob: 35333144dece29e856ab47b838df324e2ec8cf77 [file] [log] [blame]
Willy Tarreau67b5a162019-08-11 16:38:56 +02001/*
2 * include/types/sink.h
3 * This file provides definitions for event sinks
4 *
5 * Copyright (C) 2000-2019 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_SINK_H
23#define _TYPES_SINK_H
24
25#include <common/buffer.h>
26#include <common/compat.h>
27#include <common/config.h>
28#include <common/ist.h>
29
30/* A sink may be of several types. For now the following types are supported:
31 * (none yet)
32 */
33enum sink_type {
34 SINK_TYPE_NEW, // not yet initialized
35};
36
37/* This indicates the default event format, which is the destination's
38 * preferred format, but may be overridden by the source.
39 */
40enum sink_fmt {
41 SINK_FMT_RAW, // raw text sent as-is
42 SINK_FMT_SHORT, // raw text prefixed with a syslog level
43 SINK_FMT_ISO, // raw text prefixed with ISO time
44 SINK_FMT_TIMED, // syslog level then ISO
45 SINK_FMT_RFC3164, // regular syslog
46 SINK_FMT_RFC5424, // extended syslog
47};
48
49/* describes the configuration and current state of an event sink */
50struct sink {
51 struct list sink_list; // position in the sink list
52 const char *name; // sink name
53 const char *desc; // sink description
54 enum sink_fmt fmt; // format expected by the sink
55 enum sink_type type; // type of storage
56 uint8_t syslog_facility; // used by syslog format
57 uint8_t syslog_minlvl; // used by syslog & short formats
58 uint32_t maxlen; // max message length (truncated above)
59 struct {
60 unsigned int dropped; // dropped events since last one.
61 __decl_hathreads(HA_RWLOCK_T lock); // used by some types
62 } ctx;
63};
64
65#endif /* _TYPES_SINK_H */
66
67/*
68 * Local variables:
69 * c-indent-level: 8
70 * c-basic-offset: 8
71 * End:
72 */