-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Volodymyr Polishchuk edited this page Feb 25, 2020
·
3 revisions
DreamFactory 4.0.1 and newer supports a very simple solution for logging all requests. All records requested in the API will be written to the database. Logging API requests service currently supports only MongoDB.
To configure the logging of all requests, you need to go to the file with the environment variables and find the LogsDB settings block.
This block contains the following variables:
-
LOGSDB_ENABLED
- boolean flag to enable or disable logging of API requests. Possible values:"true"
or"false"
. The default is"false"
. -
LOGSDB_HOST
- the host of the database to store the logs. The default islocalhost
. -
LOGSDB_PORT
- the database connection port. The default is27017
-
LOGSDB_DATABASE
- the name of the database for logging. -
LOGSDB_USERNAME
- username with database access permissions. -
LOGSDB_PASSWORD
- user password.
If LOGSDB_ENABLED
is set to false, no request will be logged. Also, migration will not be run.
Each request will be stored as a separate document in the access
collection provided database.
Each document will be as follows:
{
"_id": ObjectId,
"timestamp": string,
"method": string,
"uri" : string,
"body" : string,
"expireAt" : ISODate
}
-
_id
- Unique ID of document. MongoDB ObjectId docs. -
timestamp
- Document creation date. Format "YYYY-mm-dd HH-MM-SS" -
method
- Request method. For example:GET
,POST
,PUT
,PATCH
,DELETE
. -
uri
- Request path. For example:/api/v2/system/environment
,/api/v2/system
. -
body
- Request body in the string format. For example:"{\"group\":\"source control,file\"}"
,"{\"include_count\":\"true\"}"
-
expireAt
- The date this log will be deleted. By default, 45 days after creation. MongoDB Date docs