Skip to main content

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

NameDefaultTypeDescription
enabledtruebooleanDetermines whether to enable the access-log service. Set to false to disable the service.

Options

NameDefaultTypeDescriptionOptions
leveldebugstringSets the log levelsilly, trace, debug, info, warn, error, or fatal
displayRequestIdfalsebooleanDetermines whether to display the request ID in logs
displayFunctionNamefalsebooleanDetermines whether to display the function name in logs
displayFilePathhiddenstringSets how the file path is displayed in logshidden, 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.