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