Bài đăng

Đang hiển thị bài đăng từ tháng chín, 2016

Play with logger

I found something interesting today. When working with Apache I notice that you cannot have multiple ErrorLog directives for writing error logs into multiple destination (CustomLog allow this). For instance: ErrorLog /path/file1.log ErrorLog /path/file2.log ErrorLog /path/file3.log In the above config, only third ErrorLog directive working, this mean error logs only write to /path/file3.log But in many cases you would like to store logs in different locations on system (for instance centre logging with Syslog). Some articles I found on the internet show us the way to got this is pipe logs to a program, something like this: ErrorLog "|$ /usr/bin/tee -a /var/log/httpd/example.com-error_log | /usr/bin/logger -t httpd-error -p local1.error" This tell Apache pipe output logs into: (1) /usr/bin/tee append to a file (2) /usr/bin/logger send to Syslog Look at (2), by default logger split input messages into segments with 1KB of length (1024 characters) (http://man7.org/linu