1nbdkit-log-filter(1) NBDKIT nbdkit-log-filter(1)
2
3
4
6 nbdkit-log-filter - nbdkit log filter
7
9 nbdkit --filter=log plugin logfile=FILE [logappend=BOOL] [plugin-args...]
10
12 "nbdkit-log-filter" is a filter that logs all transactions. When used
13 as the first filter, it can show the original client requests; as a
14 later filter, it can show how earlier filters have modified the
15 original request. The log results are placed in a user-specified file;
16 for more details on the log format, see FILES. Note that using "nbdkit
17 -v -f" produces much more verbose logging details to stderr about every
18 aspect of nbdkit operation, although this requires running nbdkit in
19 the foreground; while the log filter is designed to work even when
20 nbdkit is run as a daemon.
21
23 The nbdkit-log-filter requires a single parameter "logfile" which
24 specifies the path of the file to use for logging. If the file already
25 exists, it will be truncated unless the "logappend" parameter was
26 specified with a value that can be parsed as a boolean true.
27
29 Serve the file disk.img, and log each client transaction in the file
30 disk.log:
31
32 nbdkit --filter=log file disk.img logfile=disk.log
33
34 Repeat the task, but with the cow (copy-on-write) filter to perform
35 local caching of data served from the original plugin:
36
37 nbdkit --filter=cow --filter=log file disk.img logfile=disk.log2
38
39 After running a client that performs the same operations under each of
40 the two servers, you can compare disk.log and disk.log2 to see the
41 impact of the caching.
42
44 This filter writes to the file specified by the "logfile=FILE"
45 parameter. All lines include a timestamp, a connection counter, then
46 details about the command. The following actions are logged: Connect,
47 Read, Write, Zero, Trim, Extents, Flush, and Disconnect. Except for
48 Connect and Disconnect, an event is logged across two lines for call
49 and return value, to allow tracking duration and tracing any parallel
50 execution, using id for correlation (incremented per action on the
51 connection).
52
53 An example logging session of a client that performs a single
54 successful read is:
55
56 2018-01-27 20:38:22.959984 connection=1 Connect size=0x400 write=1 flush=1 rotational=0 trim=0 zero=1 fua=1
57 2018-01-27 20:38:23.001720 connection=1 Read id=1 offset=0x0 count=0x100 ...
58 2018-01-27 20:38:23.001995 connection=1 ...Read id=1 return=0 (Success)
59 2018-01-27 20:38:23.044259 connection=1 Disconnect transactions=1
60
62 nbdkit(1), nbdkit-file-plugin(1), nbdkit-cow-filter(1),
63 nbdkit-filter(3).
64
66 Eric Blake
67
69 Copyright (C) 2018 Red Hat Inc.
70
72 Redistribution and use in source and binary forms, with or without
73 modification, are permitted provided that the following conditions are
74 met:
75
76 · Redistributions of source code must retain the above copyright
77 notice, this list of conditions and the following disclaimer.
78
79 · Redistributions in binary form must reproduce the above copyright
80 notice, this list of conditions and the following disclaimer in the
81 documentation and/or other materials provided with the
82 distribution.
83
84 · Neither the name of Red Hat nor the names of its contributors may
85 be used to endorse or promote products derived from this software
86 without specific prior written permission.
87
88 THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
89 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
90 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
91 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
92 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
93 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
94 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
95 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
96 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
97 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
98 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
99
100
101
102nbdkit-1.12.3 2019-05-21 nbdkit-log-filter(1)