DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 21st June 2008
marco64 marco64 is offline
Real Name: Marco
Port Guard
 
Join Date: May 2008
Location: Italy
Posts: 15
Default how extract specific test from Postfix logs with PHP or Perl

Hi,
I extract (in different file) several informations from Postfix logs.

more /var/log/maillog | grep NOQUEUE > /tmp/estract.txt

this extract looks like this:
PHP Code:
Jun 21 00:37:16 PUMA postfix/smtpd[29244]: NOQUEUErejectRCPT from unknown[200.141.33.198]: 504 5.5.2 <62.123.142.124>: Helo command rejectedneed fully-qualified hostnamefrom=<bey@brainpod.comto=<52366@0email.itproto=SMTP helo=<62.123.142.124>
Jun 21 00:39:51 PUMA postfix/smtpd[29303]: NOQUEUErejectRCPT from unknown[92.47.96.48]: 504 5.5.2 <62.123.142.124>: Helo command rejectedneed fully-qualified hostnamefrom=<impeller@lissamail.comto=<52366@0email.itproto=SMTP helo=<62.123.142.124>
Jun 21 00:50:26 PUMA postfix/smtpd[29449]: NOQUEUErejectRCPT from unknown[190.244.138.229]: 450 4.1.2 <52366@0email.it>: Recipient address rejectedDomain not foundfrom=<Sascha.Taddeusz@evisibility.comto=<52366@0email.itproto=ESMTP helo=<229-138-244-190.fibertel.com.ar>
Jun 21 00:51:27 PUMA postfix/smtpd[29449]: NOQUEUErejectRCPT from unknown[190.244.138.229]: 450 4.1.2 <52366@0email.it>: Recipient address rejectedDomain not foundfrom=<Sascha.Taddeusz@evisibility.comto=<52366@0email.itproto=ESMTP helo=<229-138-244-190.fibertel.com.ar
I would like to extract the IPs. For example from:
PHP Code:
Jun 21 00:51:27 PUMA postfix/smtpd[29449]: NOQUEUErejectRCPT from unknown[190.244.138.229]: 450 4.1.2 <52366@0email.it>: Recipient address rejectedDomain not foundfrom=<Sascha.Taddeusz@evisibility.comto=<52366@0email.itproto=ESMTP helo=<229-138-244-190.fibertel.com.ar
I want 190.244.138.229 for furthere handling.

Started to handle it with a PHP script but this is not solved and is becoming a time-consuming job. Though that maybe there is something ready-to-use or a good advice could help.
Reply With Quote
 

Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to test whether an IP address has been listed in a DNSBL J65nko Guides 12 2nd February 2016 03:30 AM
scompat extract failed rtwingfield FreeBSD Ports and Packages 2 22nd June 2009 05:15 PM
test port connection carpman FreeBSD Security 5 9th February 2009 11:12 AM
tftp logs syrushcw FreeBSD General 1 25th June 2008 04:06 PM
How do I get network logs? Johnny2Bad FreeBSD General 2 22nd May 2008 05:37 PM


All times are GMT. The time now is 03:37 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick