]> git.sur5r.net Git - openldap/blob - doc/man/man5/slapo-accesslog.5
ITS#6656 Docs for reqEntryUUID
[openldap] / doc / man / man5 / slapo-accesslog.5
1 .TH SLAPO-ACCESSLOG 5 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" Copyright 2005-2017 The OpenLDAP Foundation All Rights Reserved.
3 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
4 .\" $OpenLDAP$
5 .SH NAME
6 slapo\-accesslog \- Access Logging overlay to slapd
7 .SH SYNOPSIS
8 ETCDIR/slapd.conf
9 .SH DESCRIPTION
10 The Access Logging overlay can be used to record all accesses to a given
11 backend database on another database. This allows all of the activity on
12 a given database to be reviewed using arbitrary LDAP queries, instead of
13 just logging to local flat text files. Configuration options are available
14 for selecting a subset of operation types to log, and to automatically
15 prune older log records from the logging database.  Log records are stored
16 with audit schema (see below) to assure their readability whether viewed
17 as LDIF or in raw form.
18 .SH CONFIGURATION
19 These
20 .B slapd.conf
21 options apply to the Access Logging overlay.
22 They should appear after the
23 .B overlay
24 directive.
25 .TP
26 .B logdb <suffix>
27 Specify the suffix of a database to be used for storing the log records.
28 The specified database must be defined elsewhere in the configuration.
29 The access controls
30 on the log database should prevent general access. The suffix entry
31 of the log database will be created automatically by this overlay. The log
32 entries will be generated as the immediate children of the suffix entry.
33 .TP
34 .B logops <operations>
35 Specify which types of operations to log. The valid operation types are
36 abandon, add, bind, compare, delete, extended, modify, modrdn, search,
37 and unbind. Aliases for common sets of operations are also available:
38 .RS
39 .TP
40 .B writes
41 add, delete, modify, modrdn
42 .TP
43 .B reads
44 compare, search
45 .TP
46 .B session
47 abandon, bind, unbind
48 .TP
49 .B all
50 all operations
51 .RE
52 .TP
53 .B logbase <operations> <baseDN>
54 Specify a set of operations that will only be logged if they occur under
55 a specific subtree of the database. The operation types are as above for
56 the
57 .B logops
58 setting, and delimited by a '|' character.
59 .TP
60 .B logold <filter>
61 Specify a filter for matching against Deleted and Modified entries. If
62 the entry matches the filter, the old contents of the entry will be
63 logged along with the current request.
64 .TP
65 .B logoldattr <attr> ...
66 Specify a list of attributes whose old contents are always logged in
67 Modify and ModRDN requests. Usually only the contents of attributes that were
68 actually modified will be logged; by default no old attributes are logged
69 for ModRDN requests.
70 .TP
71 .B logpurge <age> <interval>
72 Specify the maximum age for log entries to be retained in the database,
73 and how often to scan the database for old entries. Both the
74 .B age
75 and
76 .B interval
77 are specified as a time span in days, hours, minutes, and seconds. The
78 time format is [ddd+]hh:mm[:ss] i.e., the days and seconds components are
79 optional but hours and minutes are required. Except for days, which can
80 be up to 5 digits, each numeric field must be exactly two digits. For example
81 .RS
82 .RS
83 .PD 0
84 .TP
85 logpurge 2+00:00 1+00:00
86 .RE
87 .PD
88 would specify that the log database should be scanned every day for old
89 entries, and entries older than two days should be deleted. When using a
90 log database that supports ordered indexing on generalizedTime attributes,
91 specifying an eq index on the
92 .B reqStart
93 attribute will greatly benefit the performance of the purge operation.
94 .RE
95 .TP
96 .B logsuccess TRUE | FALSE
97 If set to TRUE then log records will only be generated for successful
98 requests, i.e., requests that produce a result code of 0 (LDAP_SUCCESS).
99 If FALSE, log records are generated for all requests whether they
100 succeed or not. The default is FALSE.
101
102 .SH EXAMPLES
103 .LP
104 .nf
105         database mdb
106         suffix dc=example,dc=com
107         \...
108         overlay accesslog
109         logdb cn=log
110         logops writes reads
111         logbase search|compare ou=testing,dc=example,dc=com
112         logold (objectclass=person)
113
114         database mdb
115         suffix cn=log
116         \...
117         index reqStart eq
118         access to *
119           by dn.base="cn=admin,dc=example,dc=com" read
120 .fi
121
122 .SH SCHEMA
123 The
124 .B accesslog
125 overlay utilizes the "audit" schema described herein.
126 This schema is specifically designed for
127 .B accesslog
128 auditing and is not intended to be used otherwise.  It is also
129 noted that the schema described here is
130 .I a work in
131 .IR progress ,
132 and hence subject to change without notice.
133 The schema is loaded automatically by the overlay.
134
135 The schema includes a number of object classes and associated
136 attribute types as described below.
137
138 There is
139 a basic
140 .B auditObject
141 class from which two additional classes,
142 .B auditReadObject
143 and
144 .B auditWriteObject
145 are derived. Object classes for each type of LDAP operation are further
146 derived from these classes. This object class hierarchy is designed to
147 allow flexible yet efficient searches of the log based on either a specific
148 operation type's class, or on more general classifications. The definition
149 of the
150 .B auditObject
151 class is as follows:
152 .LP
153 .RS 4
154 (  1.3.6.1.4.1.4203.666.11.5.2.1
155     NAME 'auditObject'
156     DESC 'OpenLDAP request auditing'
157     SUP top STRUCTURAL
158     MUST ( reqStart $ reqType $ reqSession )
159     MAY ( reqDN $ reqAuthzID $ reqControls $ reqRespControls $
160         reqEnd $ reqResult $ reqMessage $ reqReferral $ reqEntryUUID ) )
161 .RE
162 .P
163 Note that all of the OIDs used in the logging schema currently reside
164 under the OpenLDAP Experimental branch. It is anticipated that they
165 will migrate to a Standard branch in the future.
166
167 An overview of the attributes follows:
168 .B reqStart
169 and
170 .B reqEnd
171 provide the start and end time of the operation, respectively. They use
172 generalizedTime syntax. The
173 .B reqStart
174 attribute is also used as the RDN for each log entry.
175
176 The
177 .B reqType
178 attribute is a simple string containing the type of operation
179 being logged, e.g.
180 .BR add ,
181 .BR delete ,
182 .BR search ,
183 etc. For extended operations, the type also includes the OID of the
184 extended operation, e.g.
185 .B extended(1.1.1.1)
186
187 The
188 .B reqSession
189 attribute is an implementation-specific identifier that is common to
190 all the operations associated with the same LDAP session. Currently this
191 is slapd's internal connection ID, stored in decimal.
192
193 The
194 .B reqDN
195 attribute is the distinguishedName of the target of the operation. E.g., for
196 a Bind request, this is the Bind DN. For an Add request, this is the DN
197 of the entry being added. For a Search request, this is the base DN of
198 the search.
199
200 The
201 .B reqAuthzID
202 attribute is the distinguishedName of the user that performed the operation.
203 This will usually be the same name as was established at the start of a
204 session by a Bind request (if any) but may be altered in various
205 circumstances.
206
207 The
208 .B reqControls
209 and
210 .B reqRespControls
211 attributes carry any controls sent by the client on the request and returned
212 by the server in the response, respectively. The attribute values are just
213 uninterpreted octet strings.
214
215 The
216 .B reqResult
217 attribute is the numeric LDAP result code of the operation, indicating
218 either success or a particular LDAP error code. An error code may be
219 accompanied by a text error message which will be recorded in the
220 .B reqMessage
221 attribute.
222
223 The
224 .B reqReferral
225 attribute carries any referrals that were returned with the result of the
226 request.
227
228 The
229 .B reqEntryUUID
230 attribute records the entryUUID attribute of the entry operated on, for an Add
231 request, this is the entryUUID of the newly created entry.
232
233 Operation-specific classes are defined with additional attributes to carry
234 all of the relevant parameters associated with the operation:
235
236 .LP
237 .RS 4
238 (  1.3.6.1.4.1.4203.666.11.5.2.4
239     NAME 'auditAbandon'
240     DESC 'Abandon operation'
241     SUP auditObject STRUCTURAL
242     MUST reqId )
243 .RE
244 .P
245 For the
246 .B Abandon
247 operation the
248 .B reqId
249 attribute contains the message ID of the request that was abandoned.
250
251 .LP
252 .RS 4
253 (  1.3.6.1.4.1.4203.666.11.5.2.5
254     NAME 'auditAdd'
255     DESC 'Add operation'
256     SUP auditWriteObject STRUCTURAL
257     MUST reqMod )
258 .RE
259 .P
260 The
261 .B Add
262 class inherits from the
263 .B auditWriteObject
264 class. The Add and Modify classes are very similar. The
265 .B reqMod
266 attribute carries all of the attributes of the original entry being added.
267 (Or in the case of a Modify operation, all of the modifications being
268 performed.) The values are formatted as
269 .RS
270 .PD 0
271 .TP
272 attribute:<+|\-|=|#> [ value]
273 .RE
274 .RE
275 .PD
276 Where '+' indicates an Add of a value, '\-' for Delete, '=' for Replace,
277 and '#' for Increment. In an Add operation, all of the reqMod values will
278 have the '+' designator.
279 .P
280 .LP
281 .RS 4
282 (  1.3.6.1.4.1.4203.666.11.5.2.6
283     NAME 'auditBind'
284     DESC 'Bind operation'
285     SUP auditObject STRUCTURAL
286     MUST ( reqVersion $ reqMethod ) )
287 .RE
288 .P
289 The
290 .B Bind
291 class includes the
292 .B reqVersion
293 attribute which contains the LDAP protocol version specified in the Bind
294 as well as the
295 .B reqMethod
296 attribute which contains the Bind Method used in the Bind. This will be
297 the string
298 .B SIMPLE
299 for LDAP Simple Binds or
300 .B SASL(<mech>)
301 for SASL Binds.
302 Note that unless configured as a global overlay, only Simple Binds using
303 DNs that reside in the current database will be logged.
304
305 .LP
306 .RS 4
307 (  1.3.6.1.4.1.4203.666.11.5.2.7
308     NAME 'auditCompare'
309     DESC 'Compare operation'
310     SUP auditObject STRUCTURAL
311     MUST reqAssertion )
312 .RE
313 .P
314 For the
315 .B Compare
316 operation the
317 .B reqAssertion
318 attribute carries the Attribute Value Assertion used in the compare request.
319
320 .LP
321 .RS 4
322 (  1.3.6.1.4.1.4203.666.11.5.2.8
323     NAME 'auditDelete'
324     DESC 'Delete operation'
325     SUP auditWriteObject STRUCTURAL
326     MAY reqOld )
327 .RE
328 .P
329 The
330 .B Delete
331 operation needs no further parameters. However, the
332 .B reqOld
333 attribute may optionally be used to record the contents of the entry prior
334 to its deletion. The values are formatted as
335 .RS
336 .PD 0
337 .TP
338 attribute: value
339 .RE
340 .PD
341 The
342 .B reqOld
343 attribute is only populated if the entry being deleted matches the
344 configured
345 .B logold
346 filter.
347
348 .LP
349 .RS 4
350 (  1.3.6.1.4.1.4203.666.11.5.2.9
351     NAME 'auditModify'
352     DESC 'Modify operation'
353     SUP auditWriteObject STRUCTURAL
354     MAY reqOld MUST reqMod )
355 .RE
356 .P
357 The
358 .B Modify
359 operation contains a description of modifications in the
360 .B reqMod
361 attribute, which was already described above in the Add operation. It may
362 optionally contain the previous contents of any modified attributes in the
363 .B reqOld
364 attribute, using the same format as described above for the Delete operation.
365 The
366 .B reqOld
367 attribute is only populated if the entry being modified matches the
368 configured
369 .B logold
370 filter.
371
372 .LP
373 .RS 4
374 (  1.3.6.1.4.1.4203.666.11.5.2.10
375     NAME 'auditModRDN'
376     DESC 'ModRDN operation'
377     SUP auditWriteObject STRUCTURAL
378     MUST ( reqNewRDN $ reqDeleteOldRDN )
379     MAY ( reqNewSuperior $ reqOld ) )
380 .RE
381 .P
382 The
383 .B ModRDN
384 class uses the
385 .B reqNewRDN
386 attribute to carry the new RDN of the request.
387 The
388 .B reqDeleteOldRDN
389 attribute is a Boolean value showing
390 .B TRUE
391 if the old RDN was deleted from the entry, or
392 .B FALSE
393 if the old RDN was preserved.
394 The
395 .B reqNewSuperior
396 attribute carries the DN of the new parent entry if the request specified
397 the new parent.
398 The
399 .B reqOld
400 attribute is only populated if the entry being modified matches the
401 configured
402 .B logold
403 filter and contains attributes in the
404 .B logoldattr
405 list.
406
407 .LP
408 .RS 4
409 (  1.3.6.1.4.1.4203.666.11.5.2.11
410     NAME 'auditSearch'
411     DESC 'Search operation'
412     SUP auditReadObject STRUCTURAL
413     MUST ( reqScope $ reqDerefAliases $ reqAttrsOnly )
414     MAY ( reqFilter $ reqAttr $ reqEntries $ reqSizeLimit $
415           reqTimeLimit ) )
416 .RE
417 .P
418 For the
419 .B Search
420 class the
421 .B reqScope
422 attribute contains the scope of the original search request, using the
423 values specified for the LDAP URL format. I.e.
424 .BR base ,
425 .BR one ,
426 .BR sub ,
427 or
428 .BR subord .
429 The
430 .B reqDerefAliases
431 attribute is one of
432 .BR never ,
433 .BR finding ,
434 .BR searching ,
435 or
436 .BR always ,
437 denoting how aliases will be processed during the search.
438 The
439 .B reqAttrsOnly
440 attribute is a Boolean value showing
441 .B TRUE 
442 if only attribute names were requested, or
443 .B FALSE
444 if attributes and their values were requested.
445 The
446 .B reqFilter
447 attribute carries the filter used in the search request.
448 The
449 .B reqAttr
450 attribute lists the requested attributes if specific attributes were
451 requested.
452 The
453 .B reqEntries
454 attribute is the integer count of how many entries were returned by
455 this search request.
456 The
457 .B reqSizeLimit
458 and
459 .B reqTimeLimit
460 attributes indicate what limits were requested on the search operation.
461
462 .LP
463 .RS 4
464 (  1.3.6.1.4.1.4203.666.11.5.2.12
465     NAME 'auditExtended'
466     DESC 'Extended operation'
467     SUP auditObject STRUCTURAL
468     MAY reqData )
469 .RE
470 .P
471 The
472 .B Extended
473 class represents an LDAP Extended Operation. As noted above, the actual OID of
474 the operation is included in the
475 .B reqType
476 attribute of the parent class. If any optional data was provided with the
477 request, it will be contained in the
478 .B reqData
479 attribute as an uninterpreted octet string.
480
481 .SH NOTES
482 The Access Log implemented by this overlay may be used for a variety of
483 other tasks, e.g. as a ChangeLog for a replication mechanism, as well
484 as for security/audit logging purposes.
485
486 .SH FILES
487 .TP
488 ETCDIR/slapd.conf
489 default slapd configuration file
490 .SH SEE ALSO
491 .BR slapd.conf (5),
492 .BR slapd\-config (5).
493
494 .SH ACKNOWLEDGEMENTS
495 .P
496 This module was written in 2005 by Howard Chu of Symas Corporation.