Hey Mark, very nice scripting job here. I modified your batch file
slightly, due to the fact that I use sysmmdd.txt instead of logmmdd.txt.
But this sure makes troubleshooting and locating the IMail log file entries
for a specific d*.smd file very simple, indeed.
Thanks for sharing this!
Bill
----- Original Message -----
From: "Mark Gordon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 15, 2003 12:12 PM
Subject: RE: [IMail Forum] Log tool
Using these tools mentioned by Len we created a batch file that will do what
you are asking for. Check the drive letters and paths to your setup.
*************************************
*** REM *** Begin search in logs.bat***
@echo off
for /f "Tokens=2-4 Delims=/ " %%i in ('date /t') do set
spamlogname=F:\Imail\spool\spam%%i%%j.log
for /f "Tokens=2-4 Delims=/ " %%i in ('date /t') do set
syslogname=F:\Imail\spool\log%%i%%j.txt
set tempfile=C:\WINNT\Temp\TempAnalizeLogsScript.txt
set tempfile2=C:\WINNT\Temp\TempAnalizeLogsScript2.txt
set /P searchstring="Enter the string to search in the logs:"
set /P searchdate="Enter Date(MMDD) (ENTER for today):"
if not "%searchdate%"=="" set
spamlogname=F:\Imail\spool\log_archive\spam%searchdate%.log
if not "%searchdate%"=="" set
syslogname=F:\Imail\spool\log_archive\log%searchdate%.txt
echo OPENING %spamlogname% and %syslogname% looking for %searchstring%
echo " "
Rem Search in Logs for lines matching the initial string
cat %spamlogname% %syslogname% | grep "%searchstring%" | cut -d"(" -f2 |
cut -d")" -f1 |sort |uniq > %tempfile%
for /F %%i in (%tempfile%) do call :ProcessID %%i
echo "------------END ------------- "
pause
goto :EOF
:ProcessID i
echo +++++++++++ EMail ID: %1
cat %spamlogname% %syslogname% | grep %1
Rem ... and search in the previous results for Email IDs of the Queued
messages
cat %spamlogname% %syslogname% | grep %1 |grep "F:\\IMail\\spool\\D" |
cut -d"\\" -f4 | cut -d"." -f1 |sort |uniq | sed -e "s/D/Q/g" > %tempfile2%
Rem Have to remove the queued name
Rem 08:13 09:45 SMTPD(0B670080) [12.22.229.114]
F:\IMail\spool\D41050b6700804be7.SMD 14151
Rem And do a search on that number, then pull the email ID of whoever is
doing the queue processing
set QueueName=""
for /F %%i in (%tempfile2%) do (set QueueName=%%i)
if %QueueName%=="" goto EndProcessID
echo Queue Name : %QueueName%
cat %spamlogname% %syslogname% | grep "%QueueName%" | grep "processing" |
cut -d"(" -f2 | cut -d")" -f1 |sort |uniq > %tempfile2%
for /F %%i in (%tempfile2%) do (set ProcessIDQueue=%%i)
cat %spamlogname% %syslogname% | grep %ProcessIDQueue%
:EndProcessID
pause
************************************
End code
************************************
-----Original Message-----
From: Len Conrad [mailto:[EMAIL PROTECTED]
Sent: Friday, December 12, 2003 2:14 PM
To: [EMAIL PROTECTED]
Subject: Re: [IMail Forum] Log tool
>Actually, I could dump it to the linux box beside me and use grep <grin>.
these are free and completely serviceable:
<http://unxutils.sourceforge.net>http://unxutils.sourceforge.net.
>I was sort of hoping someone had written a tool that would take an argument
>(like domain name) and find all related items by determining the queue file
>name etc automatically since the ID number changes from the time the
>message is initially injected by a user (SMTPD messages) and the message is
>queued for delivery to the remote domain (SMTP- messages). The "deliver to"
>domain name is not on every line dealing with the message so that's useless
>as a search term.
yep, it's pretty hard in that case when no single log line carries all the
MTA+envelope info.
We have a "fake" reject filter in IMGate to get all info on one line.
>Looks like I'll ave to do it by hand. <sigh>
not by hand, but it does take a lot of effort to get something useful.
Len
_____________________________________________________________________
http://MenAndMice.com/DNS-training: Orlando; San Jose
IMGate.MEIway.com: anti-spam gateway, effective on 1000's of sites, free
To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/
To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/
To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/