Access Log
The Access Log plugin allows you to keep track of incoming requests and monitor the activity on your API server. With the Access Log, you can easily identify and analyze traffic patterns, detect issues, and optimize the performance of your API.
Usage
vulcan.yaml
access-log:
enabled: true
options:
level: info
displayRequestId: true
displayFunctionName: true
displayFilePath: hideNodeModulesOnly
With this configuration, the access-log output will look like:
2022-09-26 08:04:08.307 INFO [ACCESS_LOG packages/serve/src/lib/middleware/accessLogMiddleware.ts:23 AccessLogMiddleware.<anonymous>] --> ::1 -- "GET /api/artist/1" -- size: none
2022-09-26 08:04:08.308 INFO [ACCESS_LOG packages/serve/src/lib/middleware/accessLogMiddleware.ts:26 AccessLogMiddleware.<anonymous>] -> header: {"xxxxxxxxxxxx"}
2022-09-26 08:04:08.308 INFO [ACCESS_LOG packages/serve/src/lib/middleware/accessLogMiddleware.ts:27 AccessLogMiddleware.<anonymous>] -> query: {}
2022-09-26 08:04:08.310 INFO [ACCESS_LOG packages/serve/src/lib/middleware/accessLogMiddleware.ts:28 AccessLogMiddleware.<anonymous>] -> params: undefined
Settings
Name | Default | Type | Description |
---|---|---|---|
enabled | true | boolean | Determines whether to enable the access-log service. Set to false to disable the service. |
Options
Name | Default | Type | Description | Options |
---|---|---|---|---|
level | debug | string | Sets the log level | silly, trace, debug, info, warn, error, or fatal |
displayRequestId | false | boolean | Determines whether to display the request ID in logs | |
displayFunctionName | false | boolean | Determines whether to display the function name in logs | |
displayFilePath | hidden | string | Sets how the file path is displayed in logs | hidden, displayAll, or hideNodeModulesOnly |
VulcanSQL uses tslog
for logging. While it comes with reasonable default settings, you can customize them through vulcan.yaml
to better suit your needs.