3 ms·
You can ssh host1 tail -F log | sed -e s/^/host1:/ But you might eventually want to log everything to a third host. Use syslog to send logs across the network
by gorgoiler 5y ago
You can ssh host1 tail -F log | sed -e s/^/host1:/
But you might eventually want to log everything to a third host. Use syslog to send logs across the network and configure your local software to log to syslog.
When you have 10k hosts then sampling 1 in N log lines is still useful as a canary, while avoiding being a firehouse for the central log sampler. If something heinous occurs you can get the unsampled log from the original machine, if you need it.
Much more sophisticated techniques abound, and others will comment I’m sure, but it’s also nice to have the syslog trail as a fallback. You never know in advance what’s going to fail and syslog will show you everything from your Apache logs to kernel bugs and faulty NICs.
- jolmg 5y ago> You can ssh host1 tail -F log | sed -e s/^/host1:/ That's only for one host. If you mean something akin to: tail -F <(ssh ...) <(ssh ...) that wouldn't work, because `tail` would wait for the first `ssh/sed` to close their output (to reach the end of the first pipe) before starting to read the second `ssh/sed`'s output.
- a1369209993 5y agoYou can do: $ ssh ... >a.log & $ ssh ... >b.log & $ tail -F a.log b.log
- jolmg 5y agoYou're right. That's pretty practical. I guess I try too hard to avoid writing to disk when I can.