I am using SPDY server for HTTP/2 for my React.JS / Next.JS application. Unfortunately this solution needs to use Express.JS and therefore this is what I do to have request logging:
// Init the Next app:
const app = next({ dev, dir: __dirname })
const handle = app.getRequestHandler()
const options = {
key: fs.readFileSync('server.key'),
cert: fs.readFileSync('server.crt'),
}
app.prepare().then(() => {
const expressApp = express()
const format = json({
IP: ':remote-addr',
User: ':remote-user',
Timestamp: ':date[clf]',
Method: ':method',
Path: ':url',
Protocol: 'HTTP/:http-version',
Status: ':status',
ContentLength: ':res[content-length]',
Referrer: ':referrer',
Agent: ':user-agent',
ResponseTime: ':response-time ms',
})
expressApp.use(
logger(format, {
stream: accessLogStream,
})
)
expressApp.all('*', (req, res) => {
return handle(req, res)
})
const server = spdy.createServer(options, expressApp)
server.listen(port, (err) => {
if (err) {
apm.captureError(err)
console.error('Failed to start server', err)
process.exit(1)
} else {
console.log(`HTTP/2 server listening on port: ${port}`)
}
})
})
However, I get most of the request paths showing up as "Others" in my EFK logging dashboard:
How can I get the detailed request paths going into the Next.JS application?