Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Remote console setup

782 bytes added, 08:25, 18 March 2008
Setting up remote side: more subheadings, added awk trick to print time
=== Setting up remote side ===
Setup '''netcat ''' ('''nc''' on some Linux distributions) on your console server to listen on port 6666 UDP:
<pre>netcat -u -l -p6666</pre>
When your kernel prints something on the console, the text will be also captured on this netconsole server.
==== Adding to inittab ====
For automatic care about capturing on console server you can use init respawn feature in this way:
</pre>
==== Adding date/time to messages ====
 
If you want the log to contain date/time of each line, you can use '''awk''' like this:
 
netcat -u -l -p6666 | awk '{print strftime("%d %b %Y %H:%M:%S"), $0; fflush(stdout);}' >> /var/log/netconsole
 
See man strftime for info about how to tailor strftime() argument to your needs.
 
Note that if you want to add this to /etc/inittab, it should be done like this:
 
echo "netcat -u -l -p6666 | awk '{print \
strftime("%d %b %Y %H:%M:%S"), \$0; fflush(stdout);}' \
>> /var/log/netconsole" > /usr/local/sbin/netconsole
chmod a+x /usr/local/sbin/netconsole
echo "n1:23:respawn:/usr/local/sbin/netconsole" >> /etc/inittab
telinit q
 
==== Configuring logrotate ====
For long term capturing you would like to do log rotating some way. With logrotate you can do it by creating config file /etc/logrotate.d/netconsole: