I just did this remote logging this morning.
As
@Jack Yaz said, use scribe,
@cmkelley has 90% of it setup already.
You will need to install Entware on your AiMesh nodes and main Router (recommend using amtm). Then install scribe on all the devices. The router will be the syslog server - the nodes will be clients.
On your main router (usually 192.168.1.1) you would edit /opt/etc/syslog-ng.conf and uncomment these three lines (shown here already uncommented):
source net {
udp(ip(192.168.1.1) port(514));
};
and also uncomment this line in the log definition a few lines below the above:
log {
source(src);
source(net); # uncomment this and "source net" function above to get udp log messages from local network
destination(messages);
# destination(log_server); # uncomment this and "destination log_server" function above to send udp log messages to local network
};
For each mesh node, you will need to create a conf file that resides in the /opt/etc/syslog-ng.d directory.
Here is a simple one that I am using for my node:
Code:
# MeshBasement - log all AI Mesh (Basement) logs to /opt/var/log/MeshBasement.log
destination d_MeshBasement {
file("/opt/var/log/MeshBasement.log");
};
log {
source(net);
destination(d_MeshBasement);
# flags(final);
};
Be sure to create a log file in /opt/var/log with the name you defined in destination - in this case MeshBasement.log. Also make SURE to have permissions for addmin only:
chmod go-rwx /opt/var/log/MeshBasement.log (or whatever you named the file)
I would then recommend you run scribe from the shell and select "s" (check status). This will check your conf files.
Assuming ok, select rl to have scribe re-load the conf files.
The clients (nodes are much simpler). ssh into the Mesh node and again make sure scribe is installed.
First, edit the client/nodes /opt/etc/syslog-ng.log file and uncomment the lines
@cmkelley has as log_server. Here is what the lower part of syslog-ng.conf looks like after uncomment:
Code:
# if you only want to pass network messages through some syslog-ng filters, uncomment the source line below
# then add "soource(net);" to the log statement in any filter you want to pass network messages through
#source net { udp(ip(192.168.x.y) port(514)); };
# set the filename for the default log file - anything not filtered out will end up here
destination messages { file("/opt/var/log/messages"); };
# to send log messages to the local network, uncomment the destination line below
# then add "destination(log_server);" to the log statement in any filter you want to pass network messages through
destination log_server { udp("192.168.1.1" port(515)); };
log {
source(src);
# source(net); # uncomment this and "source net" function above to get udp log messages from local network
destination(messages);
log messages to local network destination(log_server); # uncomment this and "destination log_server" function above to send udp
};
Last, copy the file /opt/share/syslog-ng/examples/A00remote to /opt/etc/syslog-ng.d.
Edit the copy in /opt/share/syslog-ng.d and make sure to comment the line "destination log_server { udp("192.168.x.y" port(514)); };" - we have already defined the log_server in /opt/etc/syslog-ng.conf
Leave the rest as is.
This will result in all system log messages to be stored both locally on the node and also sent to the Router at 192.168.1.1 running syslog-ng.
BTW, also make sure to setup the logrotate file that corresponds to the nodes definition file.
For example, in my case the definition file is BasementMesh and the log file (defined in it) is BasementMesh.log.
So, I have a file called BasementMesh in /opt/etc/logrotate.d. Here is what it has:
Code:
/opt/var/log/BasementMesh.log {
postrotate
/usr/bin/killall -HUP syslog-ng
endscript
}
Again, run scribe, check status and make sure no errors - the reload (rl) the new conf files.
As a reminder - if you have installed uiScribe (and if you haven't - do so - highly recommended) you should run uiScribe on the Router and allow your new node to be shown for display (option 1 - customize list of log displays and make sure your node is enabled in the list)