선 밖에 선 자유인

syslog-ng 로그 서버 설정 예제 본문

IT/System & Network

syslog-ng 로그 서버 설정 예제

Hotman 2016. 8. 10. 19:19

- remote syslog-ng 서버 예시

all_log / 호스트별 / 날짜별 로그 저장


 

- /etc/syslog-ng.conf 


--------------------------------------------------------------------------------------------------

source s_sys {

    file ("/proc/kmsg" program_override("kernel: "));

    unix-stream ("/dev/log");

    internal();

    # udp(ip(0.0.0.0) port(514));

};


source LOG_ZONE {

    udp(ip(0.0.0.0) port(514));

};


destination d_all { file("/LOG/all_log"); };

destination d_host { file("/LOG/hosts/$HOST/$YEAR/$MONTH/$DAY/${FACILITY}.log" create_dirs(yes)); };

destination d_daily { file("/LOG/$YEAR/$MONTH/$DAY/$HOST/${FACILITY}.log" create_dirs(yes)); };


# remote loggin

log { source(LOG_ZONE); destination(d_all); };
log { source(LOG_ZONE); destination(d_host); };
log { source(LOG_ZONE); destination(d_daily); };
--------------------------------------------------------------------------------------------------

호스트별, IP별 로그 저장

--------------------------------------------------------------------------------------------------
source LOG_ZONE {

    udp(ip(0.0.0.0) port(514));

};

 

destination d_all { file("/LOG/all_log"); };

destination d_host { file("/LOG/hosts/$HOST/$YEAR/$MONTH/$DAY/${FACILITY}.log" create_dirs(yes)); };

destination d_daily { file("/LOG/$YEAR/$MONTH/$DAY/$HOST/${FACILITY}.log" create_dirs(yes)); };

 

# remote logging

log { source(LOG_ZONE); destination(d_all); };

log { source(LOG_ZONE); destination(d_host); };

log { source(LOG_ZONE); destination(d_daily); };

-------------------------------------------------------------------------------------------------



Comments