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