ยง2024-05-16

  1. I have a mongoDB replcation Server as follow:
  1. each member will have a log file in /opt/package/mongoDB/log/mongod.log in his own hard disk.

All the replication memebers has syslog-ng installed. I would like a hc4nas02.yushei.net machine installed with syslog-ng to be used to record all replcation memebers log into his /var/log/mongoDB-ys20220317.log using syslog-ng program.

@hc4nas02.yushei.net, /etc/syslog-ng/syslog-ng.conf is as,

@version: 3.25
@include "scl.conf"

# Sources
source s_net {
    network(ip(0.0.0.0) port(514) transport("udp"));
};

# Destinations
destination d_mongoDB {
    file("/var/log/mongoDB-ys20220317.log");
};

# Filters
filter f_redisMongo01 {
    host("redisMongo01.yushei.com.tw");
};

filter f_redisMongo02 {
    host("redisMongo02.yushei.com.tw");
};

filter f_redisMongo03 {
    host("redisMongo03.yushei.com.tw");
};

filter f_redisMongo04 {
    host("redisMongo04.yushei.com.tw");
};

# Bind Sources, Destinations, and Filters
log {
    source(s_net);
    filter(f_redisMongo01);
    destination(d_mongoDB);
};

log {
    source(s_net);
    filter(f_redisMongo02);
    destination(d_mongoDB);
};

log {
    source(s_net);
    filter(f_redisMongo03);
    destination(d_mongoDB);
};

log {
    source(s_net);
    filter(f_redisMongo04);
    destination(d_mongoDB);
};

in redismongo03.yushei.com.tw it had a /opt/package/mongoDB/log/mongod.log file that is mongoDB log file. We would like to send it to hc4nas02.yushei.net's syslog-ng, what will be the configuration file /etc/syslog-ng/syslog-ng.conf?