LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-05-2007, 06:40 AM   #1
Sushy
Member
 
Registered: Sep 2005
Distribution: FreeBSD
Posts: 84

Rep: Reputation: 15
config using regex


Hi!

I`m using logmon for real-time viewing of /var/log/maillog.
logmon.conf file in fact is simple in general, but I have some unclear things with regex.
For the clearness I want that ip addresses [xxx.xxx.xxx.xxx] are colored.
But I don`t know how to use regex to achieve this.

my logmon.conf
Code:
######################
# /var/log/maillog. #
######################
# Date
red:maillog:^... ..
# Time
magenta:maillog:... .. ..:..:..
# HostName
white:maillog:^... .. ..:..:.. *[A-Za-z]*
# Program Name
cyan:maillog:^... .. ..:..:.. *[A-Za-z]* [^ ]*
# Warnings, Fatal etc.
red:maillog:^... .. ..:..:.. *[A-Za-z]* [^ ]*: [^ ]*:
# IP addresses
yellow:maillog:???????????????????????
/var/log/maillog example form:
Apr 3 23:58:09 HostName postfix/smtpd[922]: connect from unknown[xxx.xxx.xxx.xxx]
Apr 3 23:58:09 HostName postfix/smtpd[922]: warning: unknown[xxx.xxx.xxx.xxx]: SASL LOGIN authentication failed: authentication failure
Apr 3 23:58:09 HostName postfix/smtpd[922]: disconnect from unknown[xxx.xxx.xxx.xxx]
Apr 3 23:58:26 HostName postfix/smtpd[922]: connect from unknown[xxx.xxx.xxx.xxx]


Best Regards.

Last edited by Sushy; 04-05-2007 at 06:53 AM.
 
Old 04-06-2007, 07:43 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
to match an IP using egrep:

cat <filename>|egrep "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"

by using egrep, it is matching an "extended regular expression". I don't know how this relates to the syntax for the logmon.conf file
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help from a Regex Guru? goemon Linux - Newbie 4 01-29-2007 11:14 AM
regex help siyisoy Programming 4 04-07-2006 05:32 AM
Regex Help cmfarley19 Programming 5 03-31-2005 10:13 PM
Help with Sed and regex cmfarley19 Programming 6 11-18-2004 01:09 PM
GNU C++ Regex lumux Programming 5 09-29-2003 10:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration