如何在 Ubuntu 12.04 上安装 log.io 以及如何配置 log.io 以进行日志记录?
答案1
安装
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo add-apt-repository ppa:chris-lea/node.js-devel
sudo apt-get update
sudo apt-get install nodejs npm
sudo apt-get install nodejs-dev
sudo npm config set unsafe-perm true
然后
sudo npm install -g --prefix=/usr/local log.io
配置
# cd /etc/log.io/
# ls
有 2 个文件“收割机配置文件“ “服务器配置文件“
这服务器配置文件有 2 个配置,第一个你可以更改端口,第二个你可以配置它进行身份验证
/* Log.io log server configuration */
exports.config = {
// Log server port
port: 8998, // < To Change The port
// Uncomment to enable basic HTTP authentication
/*
basic_auth: {
username: "foo",
password: "bar"
}
*/
}
现在是第二个 收割机配置文件
/* Log.io log harvester configuration */
exports.config = {
// Log server host & port
server: {
host: '127.0.0.1',
port: 8998,
},
// Watch the following log files, defined by label:path mappings
log_file_paths: {
logio_harvester: '/var/log/log.io/harvester.log'
},
// To Monitor Auth Logs
log_file_paths: {
Auth_logs: '/var/log/auth.log'
},
// To Monitor Fail2ban Logs
log_file_paths: {
Fail2ban_logs: '/var/log/fail2ban.log'
},
// To Monitor Syslogs
log_file_paths: {
Sys_logs: '/var/log/syslog'
},
// Define name of current machine.
// Alternatively, you can set this name in /etc/profile:
// export LOGIO_HARVESTER_INSTANCE_NAME='my_log_machine'
// If so, comment out the line below
instance_name : 'log_node_1'
}
您可以添加任意数量的日志路径
现在是最后一部分
sudo log.io server start && sudo log.io harvester start