Mail Log Analyze

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
yigalr01
New user
New user
Posts: 3
Joined: 2020-12-13 15:04

Mail Log Analyze

Post by yigalr01 » 2020-12-13 15:31

Hello
Can you please recommend me any software for easy analyzing Hmailserver logfiles ?
They are simple, but then we have large number of emails , there is difficult to follow them

palinka
Senior user
Senior user
Posts: 2475
Joined: 2017-09-12 17:57

Re: Mail Log Analyze

Post by palinka » 2020-12-13 15:43

Try this: https://log.damnation.org.uk/

Are you looking for something in particular in your logs?

yigalr01
New user
New user
Posts: 3
Joined: 2020-12-13 15:04

Re: Mail Log Analyze

Post by yigalr01 » 2020-12-13 15:51

Thank you ,
I know this site very nice but my logfiles is about 200 MB and more and I need offline software for analyzing this files

I am looking for most to understand if mail was successfully delivered to some people !
This is the main task for this log files :)

But may be very good to have some more detailed statists like how many mails was sent today , how off them was failed etc...

palinka
Senior user
Senior user
Posts: 2475
Joined: 2017-09-12 17:57

Re: Mail Log Analyze

Post by palinka » 2020-12-13 16:03

yigalr01 wrote:
2020-12-13 15:51
Thank you ,
I know this site very nice but my logfiles is about 200 MB and more and I need offline software for analyzing this files

I am looking for most to understand if mail was successfully delivered to some people !
This is the main task for this log files :)

But may be very good to have some more detailed statists like how many mails was sent today , how off them was failed etc...
In that case, enable AWStats logging. It logs only the result of each transaction, with from, to, and a couple of other things.

yigalr01
New user
New user
Posts: 3
Joined: 2020-12-13 15:04

Re: Mail Log Analyze

Post by yigalr01 » 2020-12-13 16:33

Ok Thank you
How can I receive the status off sent email from the AWStats log ?
I can only see from to without status...

palinka
Senior user
Senior user
Posts: 2475
Joined: 2017-09-12 17:57

Re: Mail Log Analyze

Post by palinka » 2020-12-13 16:43

yigalr01 wrote:
2020-12-13 16:33
Ok Thank you
How can I receive the status off sent email from the AWStats log ?
I can only see from to without status...
Status is 2nd to last.

250 = OK (success)

5xx = Fail

palinka
Senior user
Senior user
Posts: 2475
Joined: 2017-09-12 17:57

Re: Mail Log Analyze

Post by palinka » 2020-12-13 16:46

Here's a simple powershell script that will parse your hmailserver logs and spit out SMTPC entries only.

It takes a while to run because it has to read each line. 200mb of logs will take a while.

Code: Select all

### SCRIPT VARIABLES ###
$LogDir = "C:\hMailServer\Logs" #<-- hMailServer Log Folder

<#	First find logs   #>
Get-ChildItem $LogDir | Where {$_.Name -match "^hmailserver_[0-9]{4}-[0-9]{2}-[0-9]{2}.log$"} | ForEach {
	$LogName = $_
	
	<#	Convert log lines to objects   #>
	Get-Content "$LogDir\$LogName" | ConvertFrom-String -Delimiter "`t" -PropertyNames Protocol, ThreadID, Session, DateTime, IPAddress, Message | ForEach {

		<#	If SMTPC proceed, discard all others   #>
		If ($_.Protocol -match "SMTPC") {
			Write-Output "$($_.Session) : $($_.Message)" | Out-File "$PSScriptRoot\SMTPC.log" -Append -Encoding ASCII
			Write-Host "$($_.Session) : $($_.Message)"
		}
	}
}

User avatar
SorenR
Senior user
Senior user
Posts: 4198
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Log Analyze

Post by SorenR » 2020-12-13 18:03

yigalr01 wrote:
2020-12-13 16:33
Ok Thank you
How can I receive the status off sent email from the AWStats log ?
I can only see from to without status...
https://awstats.sourceforge.io/
SørenR.

Algorithm (noun.)
Word used by programmers when they do not want to explain what they did.

Post Reply