System Log Extended Function
Overview¶
The system log can be expanded by setting the parameter "Rds.json". It is possible to record whether the request is from the API, the site ID of the request destination, the record ID, the HTTP status, etc.
The recorded items change according to the value of "SysLogsSchemaVersion" as follows.
| SysLogsSchemaVersion | Recorded items |
|---|---|
| 1 (default) | No additional columns are recorded. |
| 2 | Api, SiteId, ReferenceId, ReferenceType, Status, and Description in "Additional Columns" below are recorded. |
| 3 | In addition to the items of "2", TenantId (tenant ID) is recorded. The maximum length of UserHostAddress (user address) is extended from 16 to 50 characters, so IPv6 addresses can be recorded without truncation. For the differences in displayed logs by tenant, refer to "Differences in Displayed Logs by Tenant" in "System Log Management Function". |
Cautions¶
- When running CodeDefiner, please take a backup of the database before running it. CodeDefiner recreates the SysLogs table and copies all existing logs. If the current number of records in the SysLogs table is large, it may take a long time to run CodeDefiner and may use a large amount of database space.
- If you change "SysLogsSchemaVersion" in the parameter "Rds.json" to a larger value, then change it back to a smaller value and run CodeDefiner, the additional columns will be deleted. Changing from "3" back to "2" deletes the TenantId column, and changing from "2" back to "1" deletes the Api, SiteId, and other columns. The deleted values are not restored even if you change the value back again. Be careful not to merge the parameter file incorrectly.
- Changing "SysLogsSchemaVersion" from "3" back to "2" or lower is not recommended. If you have no choice but to change it back, back up the SysLogs table beforehand, truncate UserHostAddress (user address) values of 17 characters or more to 16 characters or less, and then run CodeDefiner.
- Logs recorded before "SysLogsSchemaVersion" is changed to "3" have the TenantId (tenant ID) "0". When you operate multiple tenants, these logs are not displayed to "Privileged Users" of tenants other than the protected tenant.
Limitations¶
- The status code "401" is recorded only when "LoginFailure" in "SysLog.json" is true.
- The status code "403" is recorded only when the recorded table and the time limited table are accessed. If an unauthorized user accesses a folder, it is recorded as "404".
Prerequisites¶
- To reference the "System Log Management" screen, "Privileged User" is required.
Setting Procedure¶
- Change "SysLogsSchemaVersion" in the parameter "Rds.json" to "2" or "3". If you are already using "2", change it to "3" and follow the same steps.
- Run CodeDefiner.
- Verify that a log showing that the definition of the SysLogs table has been changed is output to the console.
- Check the SysLogs table and verify that the column has been added.
CodeDefiner Execution Result¶
> dotnet Implem.CodeDefiner.dll _rds
<INFO> UsersConfigurator.Execute: Implem.Pleasanter_Owner
<INFO> UsersConfigurator.Execute: Implem.Pleasanter_User
~Omitted~
<INFO> Tables.MigrateTable: SysLogs
<INFO> Tables.CreateTable: SysLogs
<INFO> Tables.MigrateTable: SysLogs_deleted
<INFO> Tables.CreateTable: SysLogs_deleted
<INFO> Tables.MigrateTable: SysLogs_history
<INFO> Tables.CreateTable: SysLogs_history
~Omitted~
<SUCCESS> Starter.ConfigureDatabase: Database configuration has been completed.
<SUCCESS> Starter.Main: All of the processes have been completed.
Additional Columns¶
Extending the system log adds six columns (Api, SiteId, ReferenceId, ReferenceType, Status, and Description) when "SysLogsSchemaVersion" is "2", and seven columns including TenantId when it is "3". For the content of each column, see "About the contents of the operation log (SysLogs table)".
When you set "SysLogsSchemaVersion" to "3", the maximum length of UserHostAddress (user address) is extended from 16 to 50 characters, so IPv6 addresses can be recorded without truncation. If it is "2" or less, only the first 16 characters are recorded.
Status Code and Details¶
One of the following status codes is output.
| Status value | Description | Example of Description |
|---|---|---|
| 200 | OK: When the request was processed successfully | (NULL) |
| 400 | Bad Request: General operation error | ResultValidators.OnUpdating:line 514:Record 99999 was locked by Administrator on 2023/07/07 12:00:00. |
| 401 | Unauthorized: When authentication failed | UserModel.LoginFailureLog:line 4403:The specified login ID or password is invalid. |
| 403 | Forbidden: When an unauthorized site is accessed | ResultValidators.OnCreating:line 216:The specified information was not found. |
| 404 | Not Found: When the web page cannot be found | ItemModel.Index:line 228:The specified information was not found. |
Supported Versions¶
| Supported versions | Body |
|---|---|
| 1.5.10.0 and later | Added "3" to "SysLogsSchemaVersion" (added TenantId, extended the maximum length of UserHostAddress to 50 characters) |