User audit logs
This feature is available from 4.23.0 and onwards.
This feature is not available in SaaS.
If your security policies require logging of the user activities in the system, such logging can be configured on Allure TestOps side.
Allure TestOps logs actions related to:
- licencing,
- user management,
- work of the end users in projects (creation, editing and deletion of entities).
Logging profiles
Overall logging in the system can be in JSON format or in text format.
The format of logs provided by Allure TestOps is defined by configuration parameter SPRING_PROFILES_ACTIVE
which always present all the configurations of Allure TestOps.
SPRING_PROFILES_ACTIVE
configuration parameters accepts many profiles divided by comma.
There are the following profiles:
kubernetes
- This profile is set as default one when running the application in Kubernetes. Events will be logged to the console (stdout) JSON format.
compose
- This profile is set as default one when running the application in docker compose. Events will be logged to the console (stdout) in text format with elements divided by spaces.
package
- This profile is set as default one when running the application deployed via Linux packages (deb or rpm). Events will be logged to the console (stdout) in in text format with elements divided by spaces.
logging-console-json
- Events will be logged to the console (stdout) in JSON format.
logging-file-json
- Events will be logged to a file in JSON format. The path to the file need must be specified via
LOG_FILE
environment variable (described below).
- Events will be logged to a file in JSON format. The path to the file need must be specified via
Logging level
For the audit logging there are two levels, defining the type of events logged by the system defined via parameter LOGGING_LEVEL_ACCESSLOG
.
debug
POST
,DELETE
,PATCH
,PUT
events will be logged- this generally means users' actions related to creation, changing/updating, deleting of entities will be logged
trace
GET
,HEAD
,OPTION
events will be logged- this type of logging will show all the users' actions and will be very excessive
Logging to a file
The logging can be performed to a file which can be processed by an application like logstash.
To log the events to a file, the configuration must contain LOG_FILE
parameter pointing to a file where the logs need to be written to.
Full logging configuration
The following piece of the configuration allows logging POST, DELETE, PATCH, PUT events in JSON format to stdout and to the file /var/log/testops/testops.log
SPRING_PROFILES_ACTIVE: logging-console-json,logging-file-json
LOGGING_LEVEL_ACCESSLOG: debug
LOG_FILE: /var/log/testops/testops.log
Log record fields
Each access log record will contain the following set of fields.
- message - message in "raw" format
- logger_name - name of the logger. For logging user actions, the logger's name will be accesslog
- method - API method invoked by the end user's action (GET/POST/PUT etc)
- endpoint - the endpoint triggered
- query - query parameters, e.g. the ID of a project, additional parameters
- status - the response status (2xx, 3xx, 4xx, 5xx)
- user - the name of the user triggered the action
- roles - user's role
- client - the IP address of the end user
Record example
{
"@timestamp": "2023-11-13T12:00:00.778Z",
"@version": "1",
"message": "status=200, method=GET, endpoint=/rs/testcasetree/leaf, query=projectId=4&treeId=8&sort=id%2Casc&size=100, client=192.168.100.4, user=admin, roles=[ROLE_ADMIN]",
"logger_name": "accesslog",
"thread_name": "http-nio-8081-exec-7",
"level": "trace",
"level_value": 5000,
"endpoint": "/rs/testcasetree/leaf",
"method": "GET",
"query": "projectId=4&treeId=8&sort=id%2Casc&size=100",
"roles": "ROLE_ADMIN",
"client": "192.168.1.4",
"user": "admin",
"status": "200"
}