1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# This file is part of vmod-binlog
# Copyright (C) 2013-2014, 2016 Sergey Poznyakoff
#
# Vmod-binlog is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# Vmod-binlog 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with vmod-binlog. If not, see <http://www.gnu.org/licenses/>.
$Module binlog 3 Binary Log File Support
COLOPHON
========
This document provides a short description of the **vmod-binlog** module.
For a detailed documentation, please see the vmod-binlog(3) manual page.
You will find documentation sources in subdirectory **doc** of the
**vmod-binlog** source tree.
DESCRIPTION
===========
This module adds binary log files support to Varnish Cache.
Binary log file consists of an arbitrary number of equally sized
records. Each record contains a UNIX timestamp in binary form and
user-defined data. The file begins with a header containing auxiliary
information.
Binary log files are rotated at preconfigured time intervals. In order
to speed up searches, their names follow the strftime(3) pattern:
%Y%m%dT%H%M%S.log
Binary logs can be viewed using the binlogcat(1) and binlogsel(1) utilities.
$Event binlog_event
$Function VOID init(PRIV_VCL, STRING, STRING, STRING)
Description
Initializes binary log engine.
Example
::
binlog.init("/var/lib/varnish/binlog", "LZ[64]L",
"size=1G;index=1;umask=027;roundts=1;debug=2");
$Function VOID start(PRIV_VCL)
Description
Initialize new binary record. It should be followed by one or
more calls to **binlog.pack** and a final call to **binlog.commit**.
Example
::
binlog.start();
$Function VOID pack(PRIV_VCL, STRING)
Description
Pack next data item into the binary log record. The item is
converted according to the second argument of **binlog.init**.
The conversion specifier is selected using the ordinal number
of this **pack** call after the latest **binlog.start**.
$Function VOID commit(PRIV_VCL)
Description
Finalize the binary log record and commit it. Any uninitialized
fields will be set to 0.
Example
::
binlog.start();
binlog.pack(http.X-Id);
binlog.pack(http.req.url);
binlog.pack(http.X-Node);
binlog.commit();
$Function VOID sync(PRIV_VCL)
Description
Synchronize the binary log with the disk file.
$Function VOID close(PRIV_VCL)
Description
Close the log. This is supposed to be called from **vcl_fini**.
SEE ALSO
========
* binlogcat(1)
* binlogsel(1)
* vcl(7)
* varnishd(1)
|