Remote Admin Via command line
Howdy ;)
I am working for a company where i do a lot of Remote Administration via command line. I have to sift through logs and logs and logs. We currently telnet 'ing into the remote servers and workstations using telnet clients. I am using CRT and PUTTY but i was wondering if someone could recommend something else where i could set up rules so that when i CAT or TAIL txt files the output would be displayed in different colors. Example just say i cat a txt file and i want the output of all the LINES with "ERROR" in them to be displayed in just say the color the RED and the rest in white. Any ideas of a program with maybe some capablities like this. Thanks Guys. Im usually running XP Pro and Winnt and 2000.
Thanks Again.
Re: Remote Admin Via command line
Quote:
Yah i have the Resoucre Kit installed so i have GREP and most of the Unix commands.
But i guess i was trying to make a life a bit more easier, to color code the lines, so the output would be a bit more clear.
Grep is excellent there is much you can do with it. Currently if im using grep i run this command to lets say find the work error in the file eventlog.log
grep -i error -A 5 -B 5 eventlog.log
First of all, avoid telnet if possible and use ssh instead. Using the right tool, anybody can sniff your telnet connection and see sensitive data across the network.
Back to the question. Now that you have most of Unix commands, I'll assume you have bash, cat, awk and printf. If you don't, download and install cygwin. I think awk is more suitable for this job than grep. And you need a (telnet/ssh) client that can interpret ANSI color codes.
Download cygwin:
http://www.cygwin.com/
ANSI color codes table:
http://pueblo.sourceforge.net/doc/ma...lor_codes.html
Create a script similar to this one on the remote server/workstation (don't forget the single quote at the bottom, it closes the awk script):
Code:
# a shell script to color code the lines in a log file
cat $1 | awk '
/INFO/ { printf "\x1B[37m%s\x1B[37m\n", $0 }
/WARNING/ { printf "\x1B[33m%s\x1B[37m\n", $0 }
/ERROR/ { printf "\x1B[31m%s\x1B[37m\n", $0 }
'
Let's say you name this script colorize.sh . To use it just type:
colorize.sh something.log
The lines in something.log will be displayed in
white if it contains the string INFO
yellow if it contains the string WARNING
red if it contains the string ERROR
Such a big effort for a simple task, do you think? Yeah me too... ;)
Why don't you import the log files into Excel and make a color coding rule in the sheet?
Peace always,
<jdenny>