Node.js
Morgan
# Write logs to a file
var accessLogStream = fs.createWriteStream(path.join(__dirname, 'access.log'), {flags: 'a'});
# Token
morgan.token('date', function(req, res, tz){
return moment().format("YYYYMMDD HH:mm:ss");
});
# Sample
app.use(morgan('combined'))
app.use(morgan(":remote-addr, :date, :url, :referrer", { stream: accessLogStream })));
Node.js 설치하기
1. CURL 설치
$ sudo apt-get install build-essential
2. PPA 추가
$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
3. NodeJS 설치
$ sudo apt-get install -y nodejs
4. build-essential 설치
$ sudo apt-get install build-essential