You will know only if your system treats viewing and exporting as events in their own right. Most business applications log sign-ins and changes to records, since that is what the financial auditor asks about. An export by an authorised employee changes nothing and trips no security alert: their rights allow it. To see it, you need three things. One log line per export (who, when, which filter, how many rows, which format), storage that neither the user nor the application administrator can alter, and an alert rule on volume.
A leak through an unlogged export comes to light through someone else: a competitor calling your customers one by one, a complaint, a spreadsheet doing the rounds. You can't say who took the data, what it contained or when it left, and suspicion hangs over a whole team for weeks. If you have to notify customers or answer the data protection authority (the CNDP in Morocco), you will be estimating the scope of the leak blind.
The test export check, in four steps
It takes a morning and needs no tools. It shows what your log actually records, whatever the vendor's documentation says.
- Ask an authorised user, or a test account with the same role, to export a list from your main application with a specific filter (one branch, one status). Write down the time, the filter and the number of rows.
- The next day, ask IT for the matching log line without telling them the time.
- Compare their answer with your notes. The named user, the time, the screen, the filter, the row count and the format should all be there.
- Note how long the answer took, then ask who in IT could have deleted that line.
If the answer takes several days, or amounts to "the user was signed in at 10:12", you know where you stand. Run the test again with a print and with an email sent from inside the application, the two other ways data leaves.
Why does an authorised export slip past your current logs?
The transaction log records who created or changed a record, which is what the auditor needs. The technical log keeps sign-ins and errors for the operations team. Neither tells you who opened a customer file or who pulled a list of twenty thousand rows.
Security tools are tuned to spot an attacker (an unusual country, bursts of failed passwords). The employee exporting their region's portfolio signs in from their own desk, with their own password, during working hours. Nothing about it looks like an intrusion.
Rights decide who may export, which is what the access rights matrix sets out, with export as an action separate from viewing. The log is what proves who did it. What is usually missing is a third log, covering views and exports.
The logging specification to copy
You can paste it into a specification as it stands. Thresholds and retention periods are parameters for IT, the business and management to agree.
1. Events to log
| Event | Also record |
|---|---|
| Sign-in, successful or refused | Channel (web, mobile, API) |
| Record viewed (customer, contract) | Record reference, never its content |
| Search or list displayed | Criteria entered, number of results |
| Export to Excel or CSV | Filter, row count, format |
| Print or email sent from the application | As for an export, plus the recipient |
| Extraction by a technical account or API | Data flow, named owner |
| Data changed | Before and after values for sensitive fields |
| Access rights changed | Who granted, who received |
| Access refused | Object requested, reason for refusal |
| Log read or changed | Any change raises an alert |
2. Fields on every line
| Field | Content |
|---|---|
| Timestamp | To the second, time zone stated, clock synchronised to a common source |
| User | Named ID, never a shared account |
| Role | Role active at the time |
| Origin | Workstation or IP address |
| Function | Screen or function used |
| Event | Type from the list above |
| Object | Reference of the record or list |
| Criteria and volume | Filter entered, row count |
| Format and destination | Excel, CSV, PDF, printer, email address |
| Outcome | Success or refusal |
| Integrity | Sequence number, hash chained to the previous line |
3. Parameters to set
| Parameter | Decision |
|---|---|
| Searchable retention | Period during which a report comes out in minutes |
| Archive | Extra period, sealed log, released on a reasoned request |
| Export threshold | Rows per export that trigger an alert |
| Relative threshold | Multiple of the user's average daily volume over thirty days |
| Normal hours | Hours and days outside which any export is flagged |
| Response time | Time the recipient has to qualify an alert |
4. Who reads the log
| Reader | Rights |
|---|---|
| Information security | Whole log and alerts, read only |
| Internal control or compliance | Whole log, read only |
| Business manager | Report limited to their own team |
| Application and database administrators | No write access, no disabling without an alert |
| External auditor | One-off extraction, itself logged |
5. Alert rules
| Rule | Trigger | Sent to |
|---|---|---|
| Bulk export | Export threshold exceeded | Security, the user's manager |
| Change of pace | Relative threshold exceeded | Security |
| Out of hours | Export outside normal hours | Security |
| Leaver | Export by a user serving notice or ending a contract | Security, HR |
| Blocking export | Export threshold exceeded by an account serving notice | The user's manager; export held until the manager approves |
| Protected records | View of an employee's record or a flagged customer | Compliance |
| Log tampering | Logging disabled, parameter changed, write attempt on the log | Security, executive management |
In a specification, the central requirement can be copied as written: "The system records every view, search, export, print and email with the named user, timestamp, criteria, volume and format, in a log that neither the user nor the application administrator can alter, and alerts security whenever an export exceeds the configured thresholds." An application that can't do this today can often be completed, without replacing it, through configuration, a log collector or an added layer. Our free audit can start from your test export result and show, event by event, what is missing.
How long should you keep logs, and where?
Set the period according to the usual gap, in your business, between a leak and its discovery. NIST SP 800-53 also leaves the retention period to the organisation (control AU-11). In France, the data protection authority (CNIL) recommends six months to a year in the general case, and accepts up to three years where logs support internal control of high-risk processing, provided that is justified. That guidance doesn't apply in Morocco, but it gives you a reasoned order of magnitude.
The same CNIL recommendation asks for logs to be kept apart from the main system, suggests write-only storage where no existing line can be overwritten, and asks for logs to be timestamped and signed as they are created. A log that lives in the database it monitors, editable by the same administrator, will carry little weight with an auditor.
Can the business pull the access report without IT?
It should be able to, for at least two questions. Who viewed or exported this customer file in the last six months? That one comes up every time a customer complains about being cold-called. What has this employee exported in the last thirty days? You ask that when someone leaves or when there is a suspicion.
If every request needs an IT ticket, the report arrives too late and people stop asking. A read-only screen, limited to the manager's scope and logged as well, is enough. A digital audit of your system will show the shortest route, and our digital consulting work helps you set the parameters with management.
What does Moroccan Law 09-08 say, and what does it require in return?
Article 23 of Law 09-08 requires the data controller to put in place appropriate technical and organisational measures to protect personal data against, among other things, disclosure and unauthorised access. It does not mention logging, but a log of views and exports helps show the obligation is being met. Article 24 goes into more detail but covers sensitive and health data, and the after-the-fact check it requires concerns data being entered, not data being read.
Logging cuts both ways, and Article 1 explains why: it lists consultation and extraction among processing operations. As the log identifies each employee, logging what they do is itself processing of their personal data. Tell users about the log, restrict its use to security and don't copy the viewed data into it. Your lawyer can check the CNDP formalities, which our Law 09-08 compliance guide walks through.
Would a consumer credit company have seen its customer file leave?
A consumer credit company has thirty branches, 350 users of its loan management application and 220,000 active customers. The company and the figures are invented for illustration. Its log records sign-ins and changes to loan files. About forty supervisors export customer lists for collection follow-ups, and those exports leave no trace.
The test export confirms it. IT takes three days to answer and finds only a sign-in at the time given. Management adopts the specification above with its own parameters: twelve months searchable, an alert above 5,000 rows per export or when a day's volume exceeds ten times the user's average daily volume over thirty days, and normal hours of 8:00 to 19:00, Monday to Friday.
At 120 views per user per day, the 350 users produce 42,000 log lines a day. Nobody will read them. The alert rules do that work.
A few months later, a regional supervisor serving notice, whose scope covers three branches and 24,000 customers, exports that entire portfolio on a Friday at 19:40. His average is 400 rows a day, which puts his relative threshold at 4,000 rows. The export is above 5,000 rows, above his relative threshold, out of hours and from an account serving notice: four alerts go out, and the blocking export rule applies. The file is never produced. The log line shows the filter ("all branches in my scope, all statuses"), the Excel format and the workstation. On Monday morning, security and the regional director have the held request and a dated, sealed record.
FAQ
- Will logging every view slow the application down?
Writing a log line is light if it goes to a collection service rather than into the business tables. Measure the effect during a load test with your real volume of views. If one heavily used screen becomes a problem, keep full detail for lists and exports and log simple record views in a more compact form.
- Can't we just block exports instead of logging them?
Removing export from roles that don't need it does reduce the risk. The roles that export as part of their job remain, and printing gets around the block. The log covers what stays open, provides the evidence and deters once users know it exists.
- Do our employees need to be told about this logging?
Yes, since the log records what they do under their own name. A message at sign-in and a line in the IT policy say what is recorded, why and for how long. Telling them also strengthens the deterrent effect, and your lawyer checks the other formalities Law 09-08 sets.
- What about exports by contractors and technical accounts?
Every automated flow needs a named owner and an account of its own, with its own thresholds. A technical account shared between several flows leaves the log silent on where an extraction came from, and the access review checks that each one still has an owner. The contractor's contract can also require the same logging for the processing it does on your behalf.
Sources
- Law No. 09-08, Articles 1, 23 and 24 (text published by the CNDP, PDF, in French)
- CNIL, Deliberation No. 2021-122 of 14 October 2021, recommendation on logging (PDF, in French)
- NIST SP 800-53 Rev. 5, control AU-11, audit record retention
Last verified: 2 November 2026.
At your next management meeting, put the test export result on the agenda, with how long IT took to answer and the list of fields missing from the log line.





