source: main/waeup.kofa/trunk/docs/source/userdocs/datacenter/logging.rst @ 12895

Last change on this file since 12895 was 12895, checked in by Henrik Bettermann, 10 years ago

Wrap lines.

File size: 20.3 KB
Line 
1.. _logging:
2
3Logfiles
4********
5
6Kofa logs actions, which cause changes to the database or the
7filesystem, in separate human-redable event logfiles. Nearly all
8actions are being logged, except some actions committed by
9applicants and students during registration periods. During these
10data initialization periods, applicants and students are requested
11to edit many fields. Usually they press the 'Save' button quite
12often to backup the data entered so far. Logging all these changes
13would mean filling the logfiles with more or less useless or
14redundant information.
15
16The main purpose of Kofa's logging facilities is to trace changes
17effected by portal officers. Applicants and students can only access
18their own data. They don't have the permission to change anything
19else. Whereas portal officers bear responsibility for the integrity
20of the whole database. Depending on the roles they have, officers
21can add, edit or remove application and study data without leaving a
22trace in the object database itself. Kofa closes this security gap
23by recording nearly all actions of portal officers into various
24event logfiles.
25
26.. note::
27
28  Kofa logs the changing but not the viewing of data (except
29  downloading export files or reports). Also entering (login) end
30  leaving (logout) the portal is **not** being recorded.
31
32Critics may claim that extensive logging may discourage officers
33from working with the portal. Persons in key functions often don't
34want to be controlled or supervised by anybody else. Indeed, Kofa
35does not respond to the desire for this kind of privacy. Datacenter
36managers can search all logfiles and can even see what their
37principles have done with the data. Goal behind is **transparency
38and security**, i.e. transparent data processing and reduction of
39the vulnerability to corruption combined with cutting-edge
40technologies to protect the data against attacks from outside.
41
42Logfiles can not be accessed directly. They can neither be
43downloaded nor viewed entirely online. But the files can be searched
44online for arbitrary `regular expressions`_. The simplest regular
45expression is a single word or a string. A technical description,
46how logfiles are being querried, can be found
47:py:meth:`here<waeup.kofa.datacenter.DataCenter.queryLogfiles>`.
48
49Each line in the logfile means a single log entry. It is composed of
50four parts: a datetime string, the log level (mainly 'INFO'), the id
51of the logged-in user, and a message part. Depending on the module,
52the message part is subdivided into further parts which are
53described below.
54
55
56main.log
57========
58
59All actions in the academic section are logged in ``main.log``.
60Changes of faculties, departments, certificates, courses and
61certificate courses done via pages in the user interface (browser
62page) are recorded in the following form::
63
64  2014-12-11 13:09:22,855 - INFO - admin - browser.pages.DepartmentAddFormPage - added: FAC1/DEP1
65  2014-12-11 13:19:31,755 - INFO - admin - browser.pages.DepartmentManageFormPage - DEP1 - saved: title
66  2014-12-12 13:19:43,255 - INFO - admin - browser.pages.FacultyManageFormPage - removed: DEP1
67
68The message part is composed of the browser page name and the action
69taken. In the example above a department ``DEP1`` was added on
70December 11, 2014 by user ``admin`` in faculty ``FAC1``, the title
71was changed 10 minutes later and, finally, the department was
72entirely removed one day later. In the same way user data and
73configuration data are logged in the main logfile. Examples::
74
75  2015-04-01 08:33:47,474 - INFO - admin - browser.pages.UserManageFormPage - Test edited: roles
76  2015-04-27 09:39:24,073 - INFO - admin - browser.pages.SessionConfigurationAddFormPage - added: 2014
77
78Furthermore, ``main.log`` does contain information about reports::
79
80  2015-04-28 15:34:31,852 - INFO - admin - students.reports.student_statistics.StudentStatisticsReportGeneratorPage - report 3029 created: Student Statistics (session=1989, mode=All, breakdown=faccode)
81  2015-04-28 15:34:37,698 - INFO - admin - students.reports.student_statistics.StudentStatisticsReportPDFView - report 3029 downloaded: StudentStatisticsReport_1989_1990_All_2015-04-28_13-34-36_UTC.pdf
82  2015-04-28 15:36:30,106 - INFO - admin - browser.reports.ReportsContainerPage - report 3029 discarded
83
84the management of documents::
85
86  2015-01-09 17:30:49,819 - INFO - admin - HOWTO - Document created
87  2015-01-09 17:30:49,822 - INFO - admin - documents.browser.DocumentAddFormPage - added: REST Document HOWTO
88
89password change requests and the usage of password mandates::
90
91  2015-04-28 13:42:52,753 - INFO - zope.anybody - browser.pages.ChangePasswordRequestPage - B1234567 - myname@gmail.com
92  2015-04-28 13:43:51,056 - INFO - zope.anybody - PasswordMandate used: B1234567
93
94``zope.anybody`` is the user id of anonnymous (non-logged-in) users.
95
96Some log entries do not contain information about a browser page.
97These entries were generated deeper in the system. The ``Document
98created`` entry, for example, was added by a workflow transition.
99The ``PasswordMandate used`` entry was added by
100:py:meth:`waeup.kofa.mandates.mandate.PasswordMandate.execute` and
101not directly by the browser page which calls this method
102(:py:meth:`waeup.kofa.mandates.browser.MandateView.update`).
103
104``main.log`` is also the place where plugins store information about
105system upgrades. If catalogs have to be re-indexed or new attributes
106of objects have to be initialized, a corresponding message is stored
107in the main logfile.
108
109
110datacenter.log
111==============
112
113All actions in the data center are logged in ``datacenter.log``.
114These are uploading import files, processing import files and
115downloading any kind of datacenter file::
116
117  2015-04-29 06:52:23,483 - INFO - admin - browser.pages.DatacenterUploadPage - uploaded: /kofa/trunk/var/datacenter/users_admin.csv
118  2015-04-29 06:52:44,025 - INFO - admin - processed: /kofa/trunk/var/datacenter/users_admin.csv, update mode, 3 lines (0 successful/ 3 failed), 0.129 s (0.0430 s/item)
119  2015-04-29 06:53:10,404 - INFO - admin - browser.pages.DatacenterPage - deleted: users_admin.update.pending.csv
120  2015-04-29 06:54:41,963 - INFO - admin - browser.pages.DatacenterUploadPage - uploaded: /kofa/trunk/var/datacenter/users2_admin.csv
121  2015-04-29 06:54:51,748 - INFO - admin - processed: /kofa/trunk/var/datacenter/users2_admin.csv, create mode, 3 lines (3 successful/ 0 failed), 0.024 s (0.0079 s/item)
122
123In the example above a user data file ``users.csv`` was uploaded and
124processed in update mode. The import failed since the 3 users didn't
125exist. The file was then deleted. User ``admin`` uploaded the file a
126second time. The file name had to be changed because the uploader
127does not allow to upload files with same name twice. The file was
128finally successfully processed in create mode.
129
130Also the export of data (export, download and discard) is recorded
131in detail::
132
133  2015-04-29 06:55:20,485 - INFO - admin - browser.pages.ExportCSVPage - exported: certificates, job_id=3036
134  2015-04-29 06:55:25,697 - INFO - admin - browser.pages.ExportCSVView - downloaded: WAeUP.Kofa_certificates_3036.csv, job_id=3036
135  2015-04-29 06:55:30,579 - INFO - admin - browser.pages.ExportCSVPage - discarded: job_id=3036
136
137
138accesscodes.log
139===============
140
141The creation of access code batches, disabling and re-enabling of
142single access codes and archiving and removal of entire batches is
143logged as follows::
144
145  2015-04-29 08:12:26,091 - INFO - admin - accesscodes.browser.AddBatchPage - created: ABC-1-2015_04_29_06_12_24-admin.csv (1000, 2300.000000)
146  2015-04-29 08:13:07,024 - INFO - admin - accesscodes.browser.BatchContainerSearchPage - disabled: ABC-1-6003657048
147  2015-04-29 08:13:11,502 - INFO - admin - accesscodes.browser.BatchContainerSearchPage - (re-)enabled: ABC-1-6003657048
148  2015-04-29 08:14:13,668 - INFO - admin - accesscodes.browser.BatchContainerPage - archived: ABC-1 (ABC-1_archive-2015_04_29_06_14_13-admin.csv)
149  2015-04-29 08:14:14,152 - INFO - admin - accesscodes.browser.BatchContainerPage - deleted: ABC-1
150
151Not all access code workflow transitions are being logged. Each
152access code has a history attribute which contains a detailed list
153of all transitions. The history is shown on the
154`BatchContainerSearchPage`.
155
156
157applicants.log
158==============
159
160The creation, editing and removal of applicants containers as well
161as editing application records (applicants) is being logged. Also
162the approval of payment tickets and all other payment ticket
163transactions are being recorded in ``applicants.log``. Kofa also
164logs all workflow transitions into both the applicant's history
165attribute and the logfile. Okay, this is somehow redundant, but it
166has proved useful to get a complete overview over all application
167data transactions also in the logfile. In return, Kofa does not
168aditionally log actions of browser pages if a workflow transition is
169triggered at the same time. Let's see the example::
170
171  2015-04-29 10:14:40,565 - INFO - admin - applicants.browser.ApplicantsContainerAddFormPage - added: app2015
172  2015-04-29 10:14:45,398 - INFO - admin - applicants.browser.ApplicantsContainerManageFormPage - app2015 - saved: startdate + enddate + application_fee
173  2015-04-29 10:15:08,779 - INFO - admin - app2015_262037 - Application initialized
174  2015-04-29 10:15:28,703 - INFO - admin - app2015_262037 - Application started
175  2015-04-29 10:15:28,704 - INFO - admin - applicants.browser.ApplicantManageFormPage - app2015_262037 - saved: reg_number + sex + course1 + date_of_birth
176  2015-04-29 10:16:27,654 - INFO - admin - applicants.browser.ApplicationFeePaymentAddPage - app2015_262037 - added: p4302953958139
177  2015-04-29 10:16:38,921 - INFO - admin - app2015_262037 - Payment approved
178  2015-04-29 10:16:38,922 - INFO - admin - applicants.browser.OnlinePaymentApprovePage - app2015_262037 - approved: p4302953958139
179  2015-04-29 10:16:58,026 - INFO - admin - app2015_262037 - Application submitted
180  2015-04-29 10:17:01,040 - INFO - admin - applicants.browser.ApplicantManageFormPage - app2015_262037 - saved: course_admitted
181  2015-04-29 10:17:10,978 - INFO - admin - app2015_262037 - Applicant admitted
182  2015-04-29 10:17:10,979 - INFO - admin - applicants.browser.ApplicantManageFormPage - app2015_262037 - saved: locked
183  2015-04-29 10:17:34,135 - INFO - admin - app2015_262037 - Student record created (K1000004)
184  2015-04-29 10:45:15,298 - INFO - admin - app2015_262037 - Applicant record removed
185  2015-04-29 10:45:15,299 - INFO - admin - applicants.browser.ApplicantsRootManageFormPage - removed: app2015
186
187An applicants container was added first. The `startdate`, `enddate`
188and the `application_fee` attributes were edited and a new
189application record (applicant) was added some seconds later. The
190`ApplicantManageFormPage` was opened, `reg_number`, `sex`, `course1`
191and `date_of_birth` was edited and the ``start`` transition was
192selected. This was done in the same transaction. The time difference
193between both log entries is only 0.001s. Furthermore, a payment
194ticket was created and the payment approved. Then the applicant was
195set to ``sumitted``, a `course_admitted` was selected and the
196applicant subsequently admitted. The form was automatically locked
197(see time difference). A student container was created and filled
198with the data from the application record. Finally, the entire
199applicants container including its content was removed in the same
200transaction, see time diffence between the last two log entries.
201
202
203students.log
204============
205
206The following example shows a typical Nigerian logfile excerpt for a
207student from the very beginning (student record creation from
208application data) till the first registration of courses at level
209100. Such an excerpt can be produced simply by searching for
210``B1234567`` on the ``students.log`` search page::
211
212  2014-12-11 10:21:21,930 - INFO - admin - B1234567 - Record created
213  2014-12-11 10:21:21,935 - INFO - admin - B1234567 - Admitted
214  2014-12-19 05:53:02,760 - INFO - admin - Student Processor - physical_clearance_date_adm - B1234567 - updated: reg_number=12345678AB, physical_clearance_date=FRIDAY 9TH JANUARY 2015
215  2014-12-22 14:16:50,494 - INFO - B1234567 - waeup.kofa.students.browser.OnlinePaymentAddFormPage - B1234567 - added: p4192542104720
216  2014-12-22 14:51:36,959 - INFO - B1234567 - waeup.kofa.interswitch.browser.InterswitchPaymentRequestWebservicePageStudent - B1234567 - valid callback for clearance payment p4192542104720: 00:Approved Successful:4500000:5964:p4192542104720:FBN|WEB|UNIBEN|22-12-2014|02345:000382768769
217  2014-12-22 14:51:36,985 - INFO - B1234567 - waeup.kofa.interswitch.browser.InterswitchPaymentRequestWebservicePageStudent - B1234567 - successful clearance payment: p4192542104720
218  2014-12-22 14:53:09,148 - INFO - B1234567 - B1234567 - Clearance started
219  2014-12-22 14:53:39,983 - INFO - B1234567 - waeup.kofa.students.browser.StudentClearanceEditFormPage - B1234567 - uploaded: birth_certificate.jpg (birth.JPG)
220  2014-12-22 14:53:54,482 - INFO - B1234567 - waeup.kofa.students.browser.StudentClearanceEditFormPage - B1234567 - uploaded: acc_let.jpg (acceptance.JPG)
221  2014-12-22 14:54:08,943 - INFO - B1234567 - waeup.kofa.students.browser.StudentClearanceEditFormPage - B1234567 - uploaded: lga_ident.jpg (LGA.JPG)
222  2014-12-22 14:54:23,541 - INFO - B1234567 - waeup.kofa.students.browser.StudentClearanceEditFormPage - B1234567 - uploaded: fst_sit_scan.jpg (waec.JPG)
223  2014-12-22 14:54:56,663 - INFO - B1234567 - waeup.kofa.students.browser.StudentClearanceEditFormPage - B1234567 - uploaded: ref_let.jpg (guarantor.JPG)
224  2014-12-22 14:56:16,039 - INFO - B1234567 - waeup.kofa.students.browser.StudentClearanceEditFormPage - B1234567 - uploaded: stat_dec.jpg (good.JPG)
225  2014-12-22 14:56:37,895 - INFO - B1234567 - waeup.kofa.students.browser.StudentClearanceEditFormPage - B1234567 - uploaded: jamb_letter.jpg (JAMB.JPG)
226  2014-12-22 14:56:54,696 - INFO - B1234567 - waeup.kofa.students.browser.StudentClearanceEditFormPage - B1234567 - uploaded: secr_cults.jpg (cult.JPG)
227  2014-12-22 15:02:42,550 - INFO - B1234567 - B1234567 - Clearance requested
228  2015-01-17 11:58:12,643 - INFO - clearanceofficer - B1234567 - Cleared
229  2015-03-10 10:58:46,217 - INFO - B1234567 - waeup.kofa.students.browser.OnlinePaymentAddFormPage - B1234567 - added: p4259815262042
230  2015-03-13 11:38:21,658 - INFO - B1234567 - waeup.kofa.interswitch.browser.InterswitchPaymentRequestWebservicePageStudent - B1234567 - valid callback for schoolfee payment p4259815262042: 00:Approved Successful:4950000:2022:p4259815262042:GTB|WEB|UNIBEN|13-03-2015|001234:0001234566
231  2015-03-13 11:38:22,016 - INFO - B1234567 - waeup.kofa.interswitch.browser.InterswitchPaymentRequestWebservicePageStudent - B1234567 - successful schoolfee payment: p4259815262042
232  2015-03-16 13:01:09,989 - INFO - B1234567 - B1234567 - First school fee payment made
233  2015-03-16 13:03:50,977 - INFO - B1234567 - waeup.kofa.students.browser.StudyLevelEditFormPage - B1234567 - added: PHY124|100|2014
234  2015-03-16 13:05:04,504 - INFO - B1234567 - B1234567 - Courses registered
235  2015-03-28 07:18:21,846 - INFO - admin - Student Processor - Matno_for_upload_25_03_2015-1_admin - B1234567 - updated: student_id=B1234567, matric_number=LSC123456
236
237The log entry format of transactions due to imports is slightly
238different::
239
240  2015-04-30 08:40:51,088 - INFO - admin - Student Processor - studentcreate_admin - B3333333 - updated: state=returning, reg_number=BIA12326, firstname=FRIDAY, middlename=None, lastname=Olonko, sex=m, nationality=NG, matric_number=SSC4444444
241  2015-04-30 08:41:27,179 - INFO - admin - StudentStudyCourse Processor (update only) - studycourseaupdate_admin - B3333333 - updated: entry_mode=ug_pt, certificate=BIA, current_session=2002, entry_session=2002, current_level=100, current_verdict=Z
242
243Two files had been uploaded by admin (``studentcreate.csv`` and
244``studycourseaupdate.csv``, see entries in ``datacenter.log``) and
245subsequently imported with the Student Processor and Student Study
246Course Processor respectively.
247
248As already stated above, not all actions committed by students are
249beeing logged. The student did not only upload a lot of files but
250also edited dozens of fields on the clearance form page and probably
251pressed the 'Save' button very often to backup the data entered so
252far. These backup transactions were skipped. All other transactions
253are being recorded. Some examples of further logfile records are
254listed below.
255
256Setting a temporary password::
257
258  2012-10-20 20:59:28,392 - INFO - admin - students.browser.LoginAsStudentStep1 - W4444444 - temp_password generated: Paa3ZVrV
259
260Deactivating and re-activating students::
261
262  2014-11-15 14:28:49,859 - INFO - admin - students.browser.StudentDeactivatePage - W1111111 - account deactivated
263  2014-11-17 10:19:05,735 - INFO - admin - students.browser.StudentActivatePage - W1111111 - account activated
264
265Rejection of clearance requests (an email is sent and the body of
266the email is stored as comment in the logfile)::
267
268  2014-10-27 12:39:34,499 - INFO - clearanceofficer - students.browser.StudentRejectClearancePage - W2222222 - comment: no credit in english
269
270Approval of payment tickets (which does not automatically goes along
271with a student workflow transition)::
272
273  2012-11-02 12:01:03,022 - INFO - admin - students.browser.OnlinePaymentApprovePage - W1000000 - schoolfee payment approved: p3517158705027
274
275Bed allocation and re-allocation::
276
277  2012-11-07 12:56:26,745 - INFO - W1000000 - waeup.kwarapoly.students.browser.BedTicketAddPage - W1000000 - booked: white-house_W_106_B
278  2013-10-29 11:49:55,048 - INFO - hostelofficer - students.browser.BedTicketRelocationPage - W1000000 - relocated: block-a-upper-hostel_A_118_E
279
280Password changes by students::
281
282  2013-02-19 08:54:50,177 - INFO - K9999999 - students.browser.StudentChangePasswordPage - K9999999 - saved: password
283
284
285payments.log
286============
287
288This file is hidden and can only be accessed directly in the
289filesystem. The payment logger is not needed in the Kofa base
290package. Only `OnlinePaymentApprovePage.update()` writes into the
291``payments.log`` file. The logger is primarily intended for storing
292information about successfull financial transactions via external
293payment gateways (e.g. PayPal, Interswitch, eTranzact). No external
294payment gateway module is configured in the base package.
295
296
297hostels.log
298===========
299
300Whereas the reservation/allocation of bed spaces is being logged in
301``students.log`` (see above), the management of hostels and beds is
302recorded in ``hostels.log``::
303
304  2015-04-30 11:44:29,145 - INFO - admin - hostels.browser.HostelAddFormPage - hostels - added: Hall 1
305  2015-04-30 11:45:29,283 - INFO - admin - hostels.browser.HostelManageFormPage - hall-1 - saved: rooms_per_floor + blocks_for_female
306  2015-04-30 11:46:29,330 - INFO - admin - hostels.browser.HostelManageFormPage - hall-1 - 0 empty beds removed, 10 beds added, 0 occupied beds modified ()
307  2015-04-30 11:47:29,433 - INFO - admin - hostels.browser.HostelManageFormPage - hall-1 - switched: hall-1_A_101_A (reserved), hall-1_A_101_B (reserved), hall-1_A_101_C (reserved), hall-1_A_101_D (reserved)
308  2015-04-30 11:47:59,283 - INFO - admin - hostels.browser.HostelManageFormPage - hall-1 - saved: beds_for_fresh + beds_for_all
309  2015-04-30 11:48:29,498 - INFO - admin - hostels.browser.HostelManageFormPage - hall-1 - 9 empty beds removed, 9 beds added, 1 occupied beds modified (hall-1_A_101_E, )
310  2015-04-30 11:49:29,560 - INFO - admin - hostels.browser.HostelManageFormPage - hall-1 - switched: hall-1_A_101_A (unreserved), hall-1_A_101_B (unreserved), hall-1_A_101_C (unreserved), hall-1_A_101_D (unreserved)
311  2015-04-30 11:50:29,689 - INFO - admin - hostels.browser.HostelManageFormPage - hall-1 - released: hall-1_A_101_D (K1000000)
312  2015-04-30 11:51:29,898 - INFO - admin - hostels.browser.BedManageFormPage - hall-1_A_101_A - saved: owner
313  2015-04-30 11:54:30,163 - INFO - admin - hostels.browser.HostelsContainerManagePage - hostels - deleted: hall-1
314
315In this example, the hostel ``Hall 1`` was added and configured,
316beds were updated, beds were reserved (switched), the hostel
317configuration was changed, beds were updated again, beds were
318unreserved, a single bed was released, a new student was allocated
319and, finally, the entire hostel was removed.
320
321Also all transactions of the Hostel Processor are being logged::
322
323  2015-04-30 11:51:12,840 - INFO - system - Hostel Processor - sample_hostel_data - hall-b - updated: beds_for_pre=['F'], floors_per_block=1, beds_for_final=['A', 'B'], rooms_per_floor=44, blocks_for_male=['C', 'D'], hostel_id=hall-b, sort_id=100, beds_for_returning=['C'], hostel_name=Hall B, beds_for_fresh=['D', 'E'], blocks_for_female=[], beds_for_all=[], beds_reserved=[]
324
325
326
327.. _regular expressions: http://en.wikipedia.org/wiki/Regular_expression
Note: See TracBrowser for help on using the repository browser.