From: Francis Dupont Date: Sat, 6 Jan 2018 08:24:32 +0000 (+0100) Subject: [5420] Updated doc X-Git-Tag: trac5502_base~6^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f936780650cddbfdbbbe154e0b46c520ea0cce6;p=thirdparty%2Fkea.git [5420] Updated doc --- diff --git a/doc/guide/admin.xml b/doc/guide/admin.xml index a4c46c7d8b..fe4b944224 100644 --- a/doc/guide/admin.xml +++ b/doc/guide/admin.xml @@ -1,7 +1,7 @@ + ]> @@ -264,7 +264,7 @@ -
+
MySQL @@ -405,7 +405,7 @@ $ kea-admin lease-upgrade mysql -u database-user
-
+
PostgreSQL @@ -584,7 +584,7 @@ $ kea-admin lease-upgrade pgsql -u database-user
-
+
CQL (Cassandra) diff --git a/doc/guide/hooks.xml b/doc/guide/hooks.xml index be499490f7..9ef2e13f65 100644 --- a/doc/guide/hooks.xml +++ b/doc/guide/hooks.xml @@ -1,7 +1,7 @@ + ]> @@ -440,15 +440,20 @@ path/base-name.CCYYMMDD.txt (for new leases) and lease4_renew (for renewed leases) hooks. - An entry is a single string with no embedded end-of-line markers - and has the following sections: + An entry is a single string with no embedded end-of-line markers, + a prepended timestamp and has the following sections: -address duration device-id {client-info} {relay-info} +timestamp address duration device-id {client-info} {relay-info} Where: + + timestamp - the current date and time the log entry was written + in "%Y-%m-%d %H:%M:%S %Z" strftime format ("%Z" is the time zone + name). + address - the leased IPv4 address given out and whether it was assigned or renewed. @@ -478,10 +483,7 @@ address duration device-id {client-info} {relay-info} For instance (line breaks added for readability, they would not be present in the log file). -Address: 192.2.1.100 has been renewed for 1 hrs 52 min 15 secs to a device with -hardware address: hwtype=1 08:00:2b:02:3f:4e, client-id: 17:34:e2:ff:09:92:54 -connected via relay at address: 192.2.16.33, identified by circuit-id: -68:6f:77:64:79 and remote-id: 87:f6:79:77:ef +2018-01-06 01:02:03 CET Address: 192.2.1.100 has been renewed for 1 hrs 52 min 15 secs to a device with hardware address: hwtype=1 08:00:2b:02:3f:4e, client-id: 17:34:e2:ff:09:92:54 connected via relay at address: 192.2.16.33, identified by circuit-id: 68:6f:77:64:79 and remote-id: 87:f6:79:77:ef @@ -494,7 +496,7 @@ connected via relay at address: 192.2.16.33, identified by circuit-id: lease4-add: -Administrator added a lease of address: *address* to a device with hardware address: *device-id* +*timestamp* Administrator added a lease of address: *address* to a device with hardware address: *device-id* Dependent on the arguments of the add command, it may also include the client-id and duration. @@ -502,13 +504,13 @@ Administrator added a lease of address: *address* to a device with hardware addr Example: -Administrator added a lease of address: 192.0.2.202 to a device with hardware address: 1a:1b:1c:1d:1e:1f for 1 days 0 hrs 0 mins 0 secs +2018-01-06 01:02:03 CET Administrator added a lease of address: 192.0.2.202 to a device with hardware address: 1a:1b:1c:1d:1e:1f for 1 days 0 hrs 0 mins 0 secs lease4-update: -Administrator updated information on the lease of address: *address* to a device with hardware address: *device-id* +*timestamp* Administrator updated information on the lease of address: *address* to a device with hardware address: *device-id* Dependent on the arguments of the update command, it may also include the client-id and lease duration. @@ -516,27 +518,27 @@ Administrator updated information on the lease of address: *address* to a device Example: -Administrator updated information on the lease of address: 192.0.2.202 to a device with hardware address: 1a:1b:1c:1d:1e:1f, client-id: 1234567890 +2018-01-06 01:02:03 CET Administrator updated information on the lease of address: 192.0.2.202 to a device with hardware address: 1a:1b:1c:1d:1e:1f, client-id: 1234567890 lease4-del: Deletes have two forms, one by address and one by identifier and identifier type: -Administrator deleted the lease for address: *address* +*timestamp* Administrator deleted the lease for address: *address* or -Administrator deleted a lease for a device identified by: *identifier-type* of *identifier* +*timestamp* Administrator deleted a lease for a device identified by: *identifier-type* of *identifier* Currently only a type of @b hw-address (hardware address) is supported. Examples: -Administrator deleted the lease for address: 192.0.2.202 +2018-01-06 01:02:03 CET Administrator deleted the lease for address: 192.0.2.202 -Administrator deleted a lease for a device identified by: hw-address of 1a:1b:1c:1d:1e:1f +2018-01-06 01:02:12 CET Administrator deleted a lease for a device identified by: hw-address of 1a:1b:1c:1d:1e:1f
@@ -549,15 +551,20 @@ Administrator deleted a lease for a device identified by: hw-address of 1a:1b:1c (for renewed leases) and lease6_rebind (for rebound leases). - An entry is a single string with no embedded end-of-line markers - and has the following sections: + An entry is a single string with no embedded end-of-line markers, + a prepended timestamp and has the following sections: -address duration device-id {relay-info}* +timestamp address duration device-id {relay-info}* Where: + + timestamp - the current date and time the log entry was written + in "%Y-%m-%d %H:%M:%S %Z" strftime format ("%Z" is the time zone + name). + address - the leased IPv6 address or prefix given out and whether it was assigned or renewed. @@ -586,11 +593,7 @@ address duration device-id {relay-info}* For instance (line breaks added for readability, they would not be present in the log file). -Address:2001:db8:1:: has been assigned for 0 hrs 11 mins 53 secs to a device with -DUID: 17:34:e2:ff:09:92:54 and hardware address: hwtype=1 08:00:2b:02:3f:4e -(from Raw Socket) connected via relay at address: fe80::abcd for client on -link address: 3001::1, hop count: 1, identified by remote-id: -01:02:03:04:0a:0b:0c:0d:0e:0f and subscriber-id: 1a:2b:3c:4d:5e:6f +2018-01-06 01:02:03 PST Address:2001:db8:1:: has been assigned for 0 hrs 11 mins 53 secs to a device with DUID: 17:34:e2:ff:09:92:54 and hardware address: hwtype=1 08:00:2b:02:3f:4e (from Raw Socket) connected via relay at address: fe80::abcd for client on link address: 3001::1, hop count: 1, identified by remote-id: 01:02:03:04:0a:0b:0c:0d:0e:0f and subscriber-id: 1a:2b:3c:4d:5e:6f @@ -603,47 +606,47 @@ link address: 3001::1, hop count: 1, identified by remote-id: lease6-add: - Administrator added a lease of address: *address* to a device with DUID: *DUID* +*timestamp* Administrator added a lease of address: *address* to a device with DUID: *DUID* Dependent on the arguments of the add command, it may also include the hardware address and duration. Example: -Administrator added a lease of address: 2001:db8::3 to a device with DUID: 1a:1b:1c:1d:1e:1f:20:21:22:23:24 for 1 days 0 hrs 0 mins 0 secs +2018-01-06 01:02:03 PST Administrator added a lease of address: 2001:db8::3 to a device with DUID: 1a:1b:1c:1d:1e:1f:20:21:22:23:24 for 1 days 0 hrs 0 mins 0 secs lease6-update: -Administrator updated information on the lease of address: *address* to a device with DUID: *DUID* +*timestamp* Administrator updated information on the lease of address: *address* to a device with DUID: *DUID* Dependent on the arguments of the update command, it may also include the hardware address and lease duration. Example: -Administrator updated information on the lease of address: 2001:db8::3 to a device with DUID: 1a:1b:1c:1d:1e:1f:20:21:22:23:24, hardware address: 1a:1b:1c:1d:1e:1f +2018-01-06 01:02:03 PST Administrator updated information on the lease of address: 2001:db8::3 to a device with DUID: 1a:1b:1c:1d:1e:1f:20:21:22:23:24, hardware address: 1a:1b:1c:1d:1e:1f lease6-del: Deletes have two forms, one by address and one by identifier and identifier type: -Administrator deleted the lease for address: *address* +*timestamp* Administrator deleted the lease for address: *address* or -Administrator deleted a lease for a device identified by: *identifier-type* of *identifier* +*timestamp* Administrator deleted a lease for a device identified by: *identifier-type* of *identifier* Currently only a type of DUID is supported. Examples: -Administrator deleted the lease for address: 2001:db8::3 +2018-01-06 01:02:03 PST Administrator deleted the lease for address: 2001:db8::3 -Administrator deleted a lease for a device identified by: duid of 1a:1b:1c:1d:1e:1f:20:21:22:23:24 +2018-01-06 01:02:11 PST Administrator deleted a lease for a device identified by: duid of 1a:1b:1c:1d:1e:1f:20:21:22:23:24
@@ -760,6 +763,60 @@ Administrator deleted a lease for a device identified by: duid of 1a:1b:1c:1d:1e to learn more about user contexts in Kea configuration.
+ +
+ Database backend + + Log entries can be inserted into a database when Kea is configured + with database backend support: a table named 'logs' is used with a + timestamp (timeuuid for Cassandra CQL) generated by the database + software and a text log with the same format than for files + without the timestamp. + + + Please refer to for MySQL, + to for PostgreSQL or + to for Cassandra CQL. + Scripts are in + path-to-kea/share/kea/legal_log/scripts directory, for instance the PostgreSQL create schema + command is: + +$ psql -d database-name -U user-name -f path-to-kea/share/kea/legal_log/scripts/pgsql/legldb_create.pgsql +Password for user user-name: +START TRANSACTION +CREATE TABLE +CREATE INDEX +CREATE TABLE +INSERT 0 1 +COMMIT +$ + + + + Configuration parameters are extended by standard lease database + parameters as defined in . + The "type" parameter should be "mysql", "postgresql", "cql" or + be "memfile". When it is absent or set to "memfile" files are + used. + + + This database feature is experimental and will be likely + improved, for instance to add an address / prefix index (currently + the only index is the timestamp). No specific tools is provided + to operate the database but standard tools are applicable, + for instance to dump the logs table from a CQL database: + +$ echo 'SELECT dateOf(timeuuid), log FROM logs;' | cqlsh -k database-name + + system.dateof(timeuuid) | log +---------------------------------+--------------------------------------- + 2018-01-06 01:02:03.227000+0000 | Address: 192.2.1.100 has been renewed ... + ... +(12 rows) +$ + + +
diff --git a/premium b/premium index 1889d087a2..3894c2072c 160000 --- a/premium +++ b/premium @@ -1 +1 @@ -Subproject commit 1889d087a2528350f232582a86d44e4bd5aeb124 +Subproject commit 3894c2072c2327af8c38dccaf26b1adfbdb45e35 diff --git a/src/lib/dhcpsrv/db_log.h b/src/lib/dhcpsrv/db_log.h index 31e2ba046f..1eb59a5caf 100644 --- a/src/lib/dhcpsrv/db_log.h +++ b/src/lib/dhcpsrv/db_log.h @@ -64,6 +64,7 @@ public: /// @brief Constructor /// /// @param logger logger which will be called + /// @param map message id translation map DbLogger(isc::log::Logger& logger, const MessageMap& map) : logger_(logger), map_(map) { }