The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
rlm_linelog.h
Go to the documentation of this file.
1/*
2 * rlm_linelog.h
3 *
4 * Version: $Id: 4c73c0d0611f8ab93ab9cee1a5a7f0b691df7ab3 $
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 *
20 * @copyright 2004,2006 The FreeRADIUS server project
21 * @copyright 2004 Alan DeKok (aland@freeradius.org)
22 */
23
24#include <freeradius-devel/server/base.h>
25
26 typedef enum {
28 LINELOG_DST_FILE, //!< Log to a file.
29 LINELOG_DST_REQUEST, //!< Log to the request->log
30 LINELOG_DST_SYSLOG, //!< Log to syslog.
31 LINELOG_DST_UNIX, //!< Log via Unix socket.
32 LINELOG_DST_UDP, //!< Log via UDP.
33 LINELOG_DST_TCP, //!< Log via TCP.
34 LINELOG_DST_STDOUT, //!< Log to stdout.
35 LINELOG_DST_STDERR, //!< Log to stderr.
37
38typedef struct {
39 fr_ipaddr_t dst_ipaddr; //!< Network server.
40 fr_ipaddr_t src_ipaddr; //!< Send requests from a given src_ipaddr.
41 uint16_t port; //!< Network port.
42 fr_time_delta_t timeout; //!< How long to wait for read/write operations.
44
45/** linelog module instance
46 */
47typedef struct {
48 fr_pool_t *pool; //!< Connection pool instance.
49
50 char const *delimiter; //!< Line termination string (usually \n).
51 size_t delimiter_len; //!< Length of line termination string.
52
53 linefr_log_dst_t log_dst; //!< Logging destination.
54 char const *log_dst_str; //!< Logging destination string.
55
56 struct {
57 char const *facility; //!< Syslog facility string.
58 char const *severity; //!< Syslog severity string.
59 int priority; //!< Bitwise | of severity and facility.
60 } syslog;
61
62 struct {
63 mode_t permissions; //!< Permissions to use when creating new files.
64 char const *group_str; //!< Group to set on new files.
65 gid_t group; //!< Resolved gid.
66 exfile_t *ef; //!< Exclusive file access handle.
67 bool escape; //!< Do filename escaping, yes / no.
68 bool fsync; //!< fsync after each write.
69 fr_time_delta_t max_idle; //!< How long to keep file metadata around without activity.
70 bool buffer_write; //!< Whether buffering is enabled.
71 uint32_t buffer_count; //!< Max number of entries to buffer before writing.
72 fr_time_delta_t buffer_delay; //!< Max time to wait before flushing buffer.
73 bool buffer_delay_is_set; //!< Whether buffer_delay was explicitly set.
74 fr_time_delta_t buffer_expiry; //!< How long to keep file metadata around without activity.
75 bool buffer_expiry_is_set; //!< Whether buffer_expiry was explicitly set.
77
78 struct {
79 char const *path; //!< Where the UNIX socket lives.
80 fr_time_delta_t timeout; //!< How long to wait for read/write operations.
81 } unix_sock; // Lowercase unix is a macro on some systems?!
82
83 linelog_net_t tcp; //!< TCP server.
84 linelog_net_t udp; //!< UDP server.
85
86 CONF_SECTION *cs; //!< #CONF_SECTION to use as the root for #log_ref lookups.
87
88 bool triggers; //!< Do we do triggers.
90
91typedef struct {
92 tmpl_t *log_src; //!< Source of log messages.
93
94 fr_value_box_t *log_ref; //!< Path to a #CONF_PAIR (to use as the source of
95 ///< log messages).
96
97 fr_value_box_t *log_head; //!< Header to add to each new log file.
98
99 fr_value_box_t *filename; //!< File name, if output is to a file.
int const char * file
Definition acutest.h:704
A section grouping multiple CONF_PAIR.
Definition cf_priv.h:101
IPv4/6 prefix.
unsigned short uint16_t
unsigned int uint32_t
unsigned int mode_t
A connection pool.
Definition pool.c:85
tmpl_t * log_src
Source of log messages.
Definition rlm_linelog.h:92
linelog_net_t tcp
TCP server.
Definition rlm_linelog.h:83
linelog_net_t udp
UDP server.
Definition rlm_linelog.h:84
fr_ipaddr_t src_ipaddr
Send requests from a given src_ipaddr.
Definition rlm_linelog.h:40
size_t delimiter_len
Length of line termination string.
Definition rlm_linelog.h:51
bool triggers
Do we do triggers.
Definition rlm_linelog.h:88
fr_ipaddr_t dst_ipaddr
Network server.
Definition rlm_linelog.h:39
fr_pool_t * pool
Connection pool instance.
Definition rlm_linelog.h:48
fr_time_delta_t timeout
How long to wait for read/write operations.
Definition rlm_linelog.h:42
linefr_log_dst_t
Definition rlm_linelog.h:26
@ LINELOG_DST_FILE
Log to a file.
Definition rlm_linelog.h:28
@ LINELOG_DST_STDERR
Log to stderr.
Definition rlm_linelog.h:35
@ LINELOG_DST_UNIX
Log via Unix socket.
Definition rlm_linelog.h:31
@ LINELOG_DST_STDOUT
Log to stdout.
Definition rlm_linelog.h:34
@ LINELOG_DST_TCP
Log via TCP.
Definition rlm_linelog.h:33
@ LINELOG_DST_INVALID
Definition rlm_linelog.h:27
@ LINELOG_DST_REQUEST
Log to the request->log.
Definition rlm_linelog.h:29
@ LINELOG_DST_UDP
Log via UDP.
Definition rlm_linelog.h:32
@ LINELOG_DST_SYSLOG
Log to syslog.
Definition rlm_linelog.h:30
fr_value_box_t * log_head
Header to add to each new log file.
Definition rlm_linelog.h:97
uint16_t port
Network port.
Definition rlm_linelog.h:41
CONF_SECTION * cs
CONF_SECTION to use as the root for #log_ref lookups.
Definition rlm_linelog.h:86
fr_value_box_t * log_ref
Path to a CONF_PAIR (to use as the source of log messages).
Definition rlm_linelog.h:94
fr_value_box_t * filename
File name, if output is to a file.
Definition rlm_linelog.h:99
char const * delimiter
Line termination string (usually ).
Definition rlm_linelog.h:50
linefr_log_dst_t log_dst
Logging destination.
Definition rlm_linelog.h:53
char const * log_dst_str
Logging destination string.
Definition rlm_linelog.h:54
linelog module instance
Definition rlm_linelog.h:47
A time delta, a difference in time measured in nanoseconds.
Definition time.h:80