Hello, I am currently utilizing the NodeJS web framework Expressjs along with a middleware called morgan to log requests to a file.
Here is my configuration:
// create a write stream (in append mode)
var accessLogStream = fs.createWriteStream(__dirname + '/logs/access.log', {flags: 'a'})
// setup the logger
app.use(logger('short', {stream: accessLogStream}))
My current log entries look like:
192.168.1.3 - GET /signup HTTP/1.1 304 - - 19.194 ms
192.168.1.3 - GET /assets/css/admin/module.admin.stylesheet-complete.sidebar_type.collapse.no_min2.css HTTP/1.1 304 - - 15.500 ms
192.168.1.3 - GET /assets/components/library/jquery/jquery.min.js?v=v1.0.3-rc2&sv=v0.0.1.1 HTTP/1.1 304 - - 14.244 ms
I am looking for a way to only log the route request, for example, if a user accesses /signup/:
192.168.1.3 - GET /signup HTTP/1.1 304 - - 19.194 ms
and exclude logging the assets required for that route.
Thank you in advance.