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 "logfile=FILE" parameter
45 This filter writes to the file specified by the "logfile=FILE"
46 parameter. All lines include a timestamp, a connection counter,
47 then details about the command. The following actions are logged:
48 Connect, Read, Write, Zero, Trim, Extents, Cache, Flush, and
49 Disconnect. Except for Connect and Disconnect, an event is logged
50 across two lines for call and return value, to allow tracking
51 duration and tracing any parallel execution, using id for
52 correlation (incremented per action on the connection).
53
54 An example logging session of a client that performs a single
55 successful read is:
56
57 2018-01-27 20:38:22.959984 connection=1 Connect size=0x400 write=1 flush=1 rotational=0 trim=0 zero=1 fua=1 extents=1 cache=0 fast_zero=0
58 2018-01-27 20:38:23.001720 connection=1 Read id=1 offset=0x0 count=0x100 ...
59 2018-01-27 20:38:23.001995 connection=1 ...Read id=1 return=0 (Success)
60 2018-01-27 20:38:23.044259 connection=1 Disconnect transactions=1
61
62 $filterdir/nbdkit-log-filter.so
63 The filter.
64
65 Use "nbdkit --dump-config" to find the location of $filterdir.
66
68 "nbdkit-log-filter" first appeared in nbdkit 1.2.
69
71 nbdkit(1), nbdkit-file-plugin(1), nbdkit-cow-filter(1),
72 nbdkit-filter(3), nbdkit-stats-filter(1).
73
75 Eric Blake
76
78 Copyright (C) 2018 Red Hat Inc.
79
81 Redistribution and use in source and binary forms, with or without
82 modification, are permitted provided that the following conditions are
83 met:
84
85 · Redistributions of source code must retain the above copyright
86 notice, this list of conditions and the following disclaimer.
87
88 · Redistributions in binary form must reproduce the above copyright
89 notice, this list of conditions and the following disclaimer in the
90 documentation and/or other materials provided with the
91 distribution.
92
93 · Neither the name of Red Hat nor the names of its contributors may
94 be used to endorse or promote products derived from this software
95 without specific prior written permission.
96
97 THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
98 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
99 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
100 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
101 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
102 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
103 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
104 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
105 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
106 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
107 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
108
109
110
111nbdkit-1.18.4 2020-04-16 nbdkit-log-filter(1)