sudomesh / sudowrt-firmware

Scripts to build the sudo mesh OpenWRT firmware.
Other
73 stars 19 forks source link

Remote Logging #68

Closed max-b closed 8 years ago

max-b commented 8 years ago

We need to get remote logging setup for 0.2 if we want to have useful feedback about the launch. I'll add it to the monitoring server. I believe that we'll want hostnames monitor.sudomesh.org instead of ip addresses, but I believe I have access to sudomesh dns so I can set that up for now.

max-b commented 8 years ago

This (or some variant) should work ok on nodes:

config system
       option hostname my.node
       option timezone PST8PDT,M3.2.0,M11.1.0
       option log_ip 100.64.0.10
       option log_size 500
       option log_file /var/log/messages
       option log_proto udp
       option log_port 514
       option log_prefix jake-tmphearth-tplink-wdr3500

For the monitoring server, I added the following file /etc/rsyslog.d/10-peoplesopen.conf with the following:

#This one is the template to generate the log filename dynamically, depending on the client's IP address.
$template RemoteHost,"/var/log/remote-ips/%fromhost-ip%-syslog.log"

$RuleSet remote
*.* ?RemoteHost

# provides UDP syslog reception
$ModLoad imudp
$InputUDPServerBindRuleset remote
$UDPServerRun 514

$RuleSet RSYSLOG_DefaultRuleset

Which will generate a new file for each ip that is remote logging.

Also need to remember to add a rule for rotating in /etc/logrotate.d/rsyslog:

/var/log/remote-ips/*.log
{
        size 2G
        rotate 36500
        daily
        missingok
        notifempty
        delaycompress
        compress
        postrotate
                reload rsyslog >/dev/null 2>&1 || true
        endscript
}
max-b commented 8 years ago

I'd like to incorporate this into https://github.com/sudomesh/sudowrt-firmware/issues/69 when I get to it.

max-b commented 8 years ago

The home nodes now have the appropriate /etc/config/system stanzas: https://github.com/sudomesh/makenode/blob/master/configs/templates/files/etc/config/system

The server monitoring ops work can/should get pushed to a later milestone.