Audit and Logging
CASPUnbound’s Crypto Asset Security Platform (“CASP”) provides the advanced
technology and the architecture to secure crypto asset transactions. and CORE have log files to help monitor the system status and operations.
CASP Log Files
CASPUnbound’s Crypto Asset Security Platform (“CASP”) provides the advanced
technology and the architecture to secure crypto asset transactions. has two log files, casp.log and casp-trace.log.
casp.log
- Path: /var/log/unbound/casp.log
- Purpose: This log file can be used for auditing. It contains every CASP
Unbound’s Crypto Asset Security Platform (“CASP”) provides the advanced technology and the architecture to secure crypto asset transactions. event, along with the associated initiator, operation, and duration.
- Structure: Each line in the log file has these fields:
- Date
-
Time
-
Threshold
-
Event
-
Owner
-
Client
-
Account ID
-
Vault ID
-
Operation ID
-
Operation Time
-
Operation Message
-
Error Details (optional)
Note
All fields can have the value N/A, except for the last field (Error Details), which can be blank.
For example:
2019-07-09 05:47:28,613 INFO POLICY_SATISFIED N/A N/A ba783c93-d79c-4406-b5cb-c5fdd5e56e69 6b60cf0f-aa68-4b19-b46d-a38614884cab N/A N/A N/A 'Policy P1 was satisfied for transaction: amount: 0.15 currency: ETH, destinations: [001CF7DA364E337B0FCA476E725B7C099F3F8EA0]'
casp-trace.log
- Path: /var/log/unbound/casp-trace.log
- Purpose: This log file is used for debugging. It contains very detailed information about all CASP
Unbound’s Crypto Asset Security Platform (“CASP”) provides the advanced technology and the architecture to secure crypto asset transactions. activities. If you contact Unbound Support you may be asked to send this file.
Note
This file is only created if you enable trace logging as described in Configure Log4j.
CASP Built-in Wallet Logs
The CASPUnbound’s Crypto Asset Security Platform (“CASP”) provides the advanced
technology and the architecture to secure crypto asset transactions. built-in wallets have their own associated log files. These log files use the winston framework for logging.
Three log transports are supported, which can be configured in config/production.yaml:
- DailyRotateFile - daily rotated file. Turned on by default. The log file is stored in /var/log/unbound/wallets. The log file is configured in config/production.yaml, which has these parameters (along with sample data):
level: info
dirname: '/var/log/unbound/wallets'
filename: 'wallets-%DATE%.log'
datePattern: 'YYYY-MM-DD-HH'
zippedArchive: true
maxSize: '20m'
maxFiles: '14d'
options:
mode: 0640
Descriptions of the configuration parameters can be found in the DailyRotateFile documentation.
Note
Over time, you may have many log files in the output directory. To view the latest one, you can use a command such as:tail -f $(ls -t *.log | head -1)
- console - turned off by default.
- file - single log file. Turned off by default.
Configure Log4j
If you want to enable trace logging:
- Edit /etc/unbound/log4j/casp.xml.
- Find the following line:
- Change it to:
<Logger name="TRACE" additivity="false" level="off">
<Logger name="TRACE" additivity="false" level="debug">
Connecting CASP to Syslog
CASPUnbound’s Crypto Asset Security Platform (“CASP”) provides the advanced
technology and the architecture to secure crypto asset transactions. logs can be forwarded to a specified syslog server for further analysis.
To forward CASPUnbound’s Crypto Asset Security Platform (“CASP”) provides the advanced
technology and the architecture to secure crypto asset transactions. logs to a syslog server, perform the following steps on the CASP
Unbound’s Crypto Asset Security Platform (“CASP”) provides the advanced
technology and the architecture to secure crypto asset transactions. server:
-
Obtain the following info regarding the syslog server:
- The hostname/IP address of the syslog server.
- The type of IP protocol used to deliver the messages (UDP/TCP).
- The syslog service port number.
Troubleshooting
To check that the connection is not blocked, telnet to the designated destination/port. For example,telnet syslog.server.ip 514
. -
Locate and open the
log4j.xml
file (refer to Configure Log4j) and add the following line before the</Appenders>
tag:<Syslog name="log" host="syslog.server.ip" protocol="TCP" port="514" newLine="true"/>
The following is an example of the complete file log4j file:
<?xml version="1.0" encoding="UTF-8" ?> <Configuration status="warn" name="CASP" packages=""> <Properties> <Property name="baseDir">/var/log/unbound</Property> </Properties> <Appenders> <RollingFile name="log" fileName="${baseDir}/casp.log" filePattern="${baseDir}/$${date:yyyy-MM}/casp.%d{yyyy-MM-dd}.log.gz"> <PatternLayout pattern="%d %-5level %m %throwable %n"/> <CronTriggeringPolicy schedule="0 0 0 * * ?"/> <DefaultRolloverStrategy> <Delete basePath="${baseDir}" maxDepth="2"> <IfFileName glob="*/casp.*.log.gz"/> <IfLastModified age="60d"/> </Delete> </DefaultRolloverStrategy> </RollingFile> <Syslog name="log" host="syslog.server.ip" protocol="TCP" port="514" newLine="true"/> </Appenders> <Loggers> <Logger name="AUDIT" additivity="false" level="info"> <AppenderRef ref="log"/> </Logger> </Loggers> </Configuration>
Note
The name field must match the corresponding ref name, such as:<AppenderRef ref="log">
-
Replace the
syslog.server.ip
string with the syslog server IP address or hostname. -
As needed, change the default protocol (TCP) and the default port (514).
-
Restart CASP
Unbound’s Crypto Asset Security Platform (“CASP”) provides the advanced technology and the architecture to secure crypto asset transactions., which is with this command:
sudo service casp.tomcat restart
-
Check that the syslog server captures the log message generated during the CASP
Unbound’s Crypto Asset Security Platform (“CASP”) provides the advanced technology and the architecture to secure crypto asset transactions. restart.
Tip
By default, a syslog server uses the/var/log/messages
file to store logs.
CORE Log Files
Descriptions of the log files for CORE can be found in the CORE Maintenance Guide.
Troubleshooting Audit Logs
500 Error
If you try and verify an audit log and receive a 500 error, it may be due to a problem with a table in the database. Audit verification can be done through these methods:
-
With the fullValidation flag. For example, see the accounts audit.
The response is similar to the following error:
{
"type": "/mng/errors/data-verification-failed",
"title": "Validation of audit data failed",
"details": "Row 24 verification failed",
"status": 500
}
This issue can be fixed, either for all audit logs or for a specific type of audit log.
Note
It is recommended to backup the database before running the following procedure.
To reset all audit data:
-
Remove all audit data by running these commands on the database.
-
Run casp_delete_ukc_secrets utility, found in the casp-service/bin directory. On success, you see:
Deleting CASP audit secrets from UKC succeeded
-
Restart the CASP
Unbound’s Crypto Asset Security Platform (“CASP”) provides the advanced technology and the architecture to secure crypto asset transactions. server.
delete from casp_audit_signs;
delete from casp_audit_pools;
delete from casp_audit_accounts;
delete from casp_audit_trusted_systems;
delete from casp_audit_users;
delete from casp_audit_vaults;
delete from casp_audit_data_collectors;
To reset audit data for a specific type of log, such as accounts:
-
Remove the audit data by running the command below on the database, corresponding to the type of log.
-
Log into the CORE user interface.
-
Access the Secrets screen.
-
Delete the two secrets (first-parent-hash and last-hash) corresponding to the type of log that you are resetting. Secret names are in this format:
casp-audit-<LOG TYPE>-first-parent-hash
casp-audit-<LOG TYPE>-last-hash -
Restart the CASP
Unbound’s Crypto Asset Security Platform (“CASP”) provides the advanced technology and the architecture to secure crypto asset transactions. server.
delete from casp_audit_signs;
delete from casp_audit_pools;
delete from casp_audit_accounts;
delete from casp_audit_trusted_systems;
delete from casp_audit_users;
delete from casp_audit_vaults;
delete from casp_audit_data_collectors;