Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi everyone,
I just added this line to my "/etc/syslog.conf":
Code:
*.* /dev/tty12
to have real-time logs printed on tty12.
The only terminals I can log in are tty[1-6] + tty7 for X, but that's ok.
Well, now I'd like to have many different colors (maybe using escape sequences) for the various types of log messages (eg: all kernel messages in green, all ACPI messages in yellow, all login failures in red, and so on) directly on the tty12, but I don't know how can I do this.
I thought I could write a Bash script which reads each line added on tty12, uses grep to discover the type of message, then colors it (using echo and redirection), but I couldn't find a way to read the data printed on tty12.
Code:
cat /dev/tty
Code:
tee /dev/tty12
these commands don't work.
I think it's very useful to have different colors instead of all-grey log messages, but what's the way to do this?
Thanks to all you people!
Bye!
Fantastic!!!
Thanx very much!
I tried it out and it works fine, but what can I do now to have the new colored logs always directed on tty12 (expecially each time they're updated, always with colors)?
I mean... should I write I kind of deamon that listens for every new log from the kernel, then colors it, then sends it to tty12 appending to the other ones before?
The only problem is that I *really* don't know how to capture new logs appended each time on tty12, because I don't know how to have that "writings" printed on the console I'm currently working on (one of tty[1-6]).
If I could read those message on my console, I could simply use "cat" to read it, send it to "rcg.perl", then send it back again to /dev/tty12, but colored this time!
BTW, I thank you very much and I'll try until I find a way!
Bye!
Hmmm... hard to say. Maybe somebody here knows more about working with TTY's than me. Personally, I would just login to the server from that console and run your commands piped through the rcg program. I do this myself all the time. I login with SSH and run the command just like I'm showing above. Actually, for some commands that I use more often, I just put them into my .bashrc file as an alias so the rcg program gets called everytime.
Just tried out this cool program: "ccze".
I found it in Debian Sid repositories thru APT (section "utils") and it colors out any kind of log files (exim, apache, syslog, ecc...), and it has much more interesting features.
Cool!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.