PM2 set logs to compress and expire

Referring to the github README.md https://github.com/pm2-hive/pm2-logrotate


pm2 install pm2-logrotate@2.6.0
pm2 set pm2-logrotate:compress true
pm2 set pm2-logrotate:max_size 10M
pm2 set pm2-logrotate:retain 7

pm2 conf

{
"pm2-logrotate": {
"max_size": "10M",
"retain": "7",
"compress": "true",
"dateFormat": "YYYY-MM-DD_HH-mm-ss",
"workerInterval": "30",
"rotateInterval": "0 0 * * *",
"rotateModule": true
},
"module-db": {
"pm2-logrotate": {
"uid": null,
"gid": null
}
}
}

nJoy 😉

Docker log files

Ubuntu – /var/log/upstart/docker.log
Boot2Docker – /var/log/docker.log
Debian, GNU/Linux – /var/log/daemon.log
CentOS6 – /var/log/daemon.log | grep docker
Fedora – journalctl -u docker.service
OpenSuSE – journalctl -u docker.service

on Centos 7
journalctl -u docker.service

nJoy 😉

Sending Elasticsearch to a syslog server

yum install rsyslog -y

Add the following to rsyslog.conf on the client system

############

$ModLoad imfile
$InputFileName /var/log/elasticsearch/elasticsearch.log
$InputFileTag elasticsearch
$InputFileStateFile stat-elasticsearch
$InputFileSeverity Info
$InputFileFacility daemon
$InputRunFileMonitor
#local3.* hostname:<portnumber>

daemon.* @192.168.1.66:514


############

 

Also if you want all logs to go through to syslog server:

 

*.* @192.168.1.66

 

at the end of the file.

Issue a :

service rsyslog restart

and watch the logs flow in.

 

nJoy 😉

 

 

 

 

Measuring Apache bandwidth from a bash script

So reason : double checking Sawmill and AWstats.

(sawmill won..)

echo “$(awk ‘{print $10}’ prd.logs | grep -v “-” | paste -sd + – | bc )/1024/1024/1024″ | bc

result is in GB.

nJoy;