Blog

Exchange Server Log Path Değiştirme Rehberi

Merhaba, Exchange Server’da bir çok servis ve bu servislerin ürettiği log dosyaları vardır. Lod dosyaları kurulumda default olarak exchange server’ın kurulduğu dosya yollarında depolanır. Ancak log analizlerlerini ve takiplerini daha kolay yapmak ayrıca performans için bu log path’leri değiştirilmelidir.

İşlemlerimizi powershell kullanarak yapacağız. İlk olarak mevcut log path’lerin mevcut durumunu görmek için aşağıdaki powershell komut setini kullanacağız. Bu komut setini sevgili hocam Fatih KARAALİOĞLU’un blog‘undan aldım kendisine teşekkür eder saygılar sunarım.

$ExportPath = “c:\Path.csv”
$ExchangeServers = Get-ExchangeServer
foreach ( $ExchangeServer in $ExchangeServers)
{

##Transport Service

Get-TransportService -Identity $ExchangeServer.Name | get-member | where Name -like “*LogPath*” |%{
$pathobj = New-Object -TypeName psobject
$values = Get-TransportService -Identity $ExchangeServer.Name | select -ExpandProperty $_.Name
if ($values -ne $null)
{
$pathobj | Add-Member -Name ServerName -Value $ExchangeServer.Name -MemberType NoteProperty
$pathobj | Add-Member -Name Type -Value “TransportService” -MemberType NoteProperty
$pathobj | Add-Member -Name PathName -Value $_.Name -MemberType NoteProperty
$pathobj | Add-Member -Name PathValue -Value $values -MemberType NoteProperty
write-output -InputObject $pathobj
Export-Csv -InputObject $pathobj -Path $ExportPath -NoTypeInformation -Encoding UTF8 -Delimiter “;” -Append
}
}

##FrontendTransportService

Get-FrontendTransportService -Identity $ExchangeServer.Name | get-member | where Name -like “*LogPath*” |%{
$pathobj = New-Object -TypeName psobject
$values = Get-FrontendTransportService -Identity $ExchangeServer.Name | select -ExpandProperty $_.Name
if ($values -ne $null)
{
$pathobj | Add-Member -Name ServerName -Value $ExchangeServer.Name -MemberType NoteProperty
$pathobj | Add-Member -Name Type -Value “FrontendTransportService” -MemberType NoteProperty
$pathobj | Add-Member -Name PathName -Value $_.Name -MemberType NoteProperty
$pathobj | Add-Member -Name PathValue -Value $values -MemberType NoteProperty
write-output -InputObject $pathobj
Export-Csv -InputObject $pathobj -Path $ExportPath -NoTypeInformation -Encoding UTF8 -Delimiter “;” -Append
}
}

##MailboxServer

Get-MailboxServer -Identity $ExchangeServer.Name | get-member | where Name -like “*LogPath*” |%{
$pathobj = New-Object -TypeName psobject
$values = Get-MailboxServer -Identity $ExchangeServer.Name | select -ExpandProperty $_.Name
if ($values -ne $null)
{
$pathobj | Add-Member -Name ServerName -Value $ExchangeServer.Name -MemberType NoteProperty
$pathobj | Add-Member -Name Type -Value “MailboxServer” -MemberType NoteProperty
$pathobj | Add-Member -Name PathName -Value $_.Name -MemberType NoteProperty
$pathobj | Add-Member -Name PathValue -Value $values -MemberType NoteProperty
write-output -InputObject $pathobj
Export-Csv -InputObject $pathobj -Path $ExportPath -NoTypeInformation -Encoding UTF8 -Delimiter “;” -Append
}
}

##MailboxTransportService

Get-MailboxTransportService -Identity $ExchangeServer.Name | get-member | where Name -like “*LogPath*” |%{
$pathobj = New-Object -TypeName psobject
$values = Get-MailboxTransportService -Identity $ExchangeServer.Name | select -ExpandProperty $_.Name
if ($values -ne $null)
{
$pathobj | Add-Member -Name ServerName -Value $ExchangeServer.Name -MemberType NoteProperty
$pathobj | Add-Member -Name Type -Value “MailboxTransportService” -MemberType NoteProperty
$pathobj | Add-Member -Name PathName -Value $_.Name -MemberType NoteProperty
$pathobj | Add-Member -Name PathValue -Value $values -MemberType NoteProperty
write-output -InputObject $pathobj
Export-Csv -InputObject $pathobj -Path $ExportPath -NoTypeInformation -Encoding UTF8 -Delimiter “;” -Append
}
}

##IMAP Settings

Get-ImapSettings -Server $ExchangeServer.Name | get-member | where Name -like “*LogFileLocation*” |%{
$pathobj = New-Object -TypeName psobject
$values = Get-ImapSettings -Server $ExchangeServer.Name | select -ExpandProperty $_.Name
if ($values -ne $null)
{
$pathobj | Add-Member -Name ServerName -Value $ExchangeServer.Name -MemberType NoteProperty
$pathobj | Add-Member -Name Type -Value “ImapSettings” -MemberType NoteProperty
$pathobj | Add-Member -Name PathName -Value $_.Name -MemberType NoteProperty
$pathobj | Add-Member -Name PathValue -Value $values -MemberType NoteProperty
write-output -InputObject $pathobj
Export-Csv -InputObject $pathobj -Path $ExportPath -NoTypeInformation -Encoding UTF8 -Delimiter “;” -Append
}
}

##POP Settings

Get-PopSettings -Server $ExchangeServer.Name | get-member | where Name -like “*LogFileLocation*” |%{
$pathobj = New-Object -TypeName psobject
$values = Get-PopSettings -Server $ExchangeServer.Name | select -ExpandProperty $_.Name
if ($values -ne $null)
{
$pathobj | Add-Member -Name ServerName -Value $ExchangeServer.Name -MemberType NoteProperty
$pathobj | Add-Member -Name Type -Value “PopSettings ” -MemberType NoteProperty
$pathobj | Add-Member -Name PathName -Value $_.Name -MemberType NoteProperty
$pathobj | Add-Member -Name PathValue -Value $values -MemberType NoteProperty
write-output -InputObject $pathobj
Export-Csv -InputObject $pathobj -Path $ExportPath -NoTypeInformation -Encoding UTF8 -Delimiter “;” -Append
}
}

}

Bu script “c:\Path.csv” isminde bir csv üretecek. Burada tüm log path’leri görebilirsiniz. Aşağıdaki kod bloğu ise path’leri yeni konumuna taşıyacaktır.

$path="d:\log"
$exchangeservername = $env:computername

#Set-TransportService için log yollarını ayarlama

Set-TransportService -Identity $exchangeservername `
-ConnectivityLogPath "$path\TransportRoles\Logs\Hub\Connectivity" `
-MessageTrackingLogPath "$path\TransportRoles\Logs\MessageTracking" `
-IrmLogPath "$path\Logging\IRMLogs" `
-ActiveUserStatisticsLogPath "$path\TransportRoles\Logs\Hub\ActiveUsersStats" `
-ServerStatisticsLogPath "$path\TransportRoles\Logs\Hub\ServerStats" `
-ReceiveProtocolLogPath "$path\TransportRoles\Logs\Hub\ProtocolLog\SmtpReceive" `
-RoutingTableLogPath "$path\TransportRoles\Logs\Hub\Routing" `
-SendProtocolLogPath "$path\TransportRoles\Logs\Hub\ProtocolLog\SmtpSend" `
-QueueLogPath "$path\TransportRoles\Logs\Hub\QueueViewer" `
-WlmLogPath "$path\TransportRoles\Logs\Hub\WLM" `
-PipelineTracingPath "$path\TransportRoles\Logs\Hub\PipelineTracing" `
-AgentLogPath "$path\TransportRoles\Logs\Hub\AgentLog" `
-GeneralLogPath "$path\TransportRoles\Logs\Hub\GeneralLog" `
-PickupDirectoryPath "$path\TransportRoles\Pickup" `
-ReplayDirectoryPath "$path\TransportRoles\Replay" `
-TransportHttpLogPath "$path\TransportRoles\Logs\Hub\TransportHttp" `
-JournalLogPath "$path\TransportRoles\Logs\JournalLog" `
-LatencyLogPath "$path\TransportRoles\Logs\Hub\LatencyLog"

#Set-FrontendTransportService için log yollarını ayarlama

Set-FrontendTransportService -Identity $exchangeservername `
-AgentLogPath "$path\TransportRoles\Logs\FrontEnd\AgentLog" `
-ConnectivityLogPath "$path\TransportRoles\Logs\FrontEnd\Connectivity" `
-ReceiveProtocolLogPath "$path\TransportRoles\Logs\FrontEnd\ProtocolLog\SmtpReceive" `
-SendProtocolLogPath "$path\TransportRoles\Logs\FrontEnd\ProtocolLog\SmtpSend" `
-RoutingTableLogPath "$path\TransportRoles\Logs\FrontEnd\Routing"

# MailBoxServer için log yolu taşıma

Set-MailboxServer -Identity $exchangeservername `
-CalendarRepairLogPath "$path\Logging\Calendar Repair Assistant" `
-LogPathForManagedFolders "$path\Logging\Managed Folder Assistant" `
-MigrationLogFilePath "$path\Logging\Managed Folder Assistant"

#Set-MailboxTransportService için log yollarını ayarlama

Set-MailboxTransportService -Identity $exchangeservername `
-ConnectivityLogPath "$path\TransportRoles\Logs\Mailbox\Connectivity" `
-MailboxDeliveryAgentLogPath "$path\TransportRoles\Logs\Mailbox\AgentLog\Delivery" `
-MailboxSubmissionAgentLogPath "$path\TransportRoles\Logs\Mailbox\AgentLog\Submission" `
-ReceiveProtocolLogPath "$path\TransportRoles\Logs\Mailbox\ProtocolLog\SmtpReceive" `
-SendProtocolLogPath "$path\TransportRoles\Logs\Mailbox\ProtocolLog\SmtpSend" `
-PipelineTracingPath "$path\TransportRoles\Logs\Mailbox\PipelineTracing" `
-RoutingTableLogPath "$path\TransportRoles\Logs\Mailbox\Routing" `
-MailboxDeliveryThrottlingLogPath "$path\TransportRoles\Logs\Throttling\Delivery"

#IIS log yolu taşıma

Import-Module WebAdministration
Set-ItemProperty 'IIS:\Sites\Default Web Site' -name logfile.directory "D:\LOG\IISLogs"
Set-ItemProperty 'IIS:\Sites\Exchange Back End' -name logfile.directory "D:\LOG\IISLogs"

#POP3 log yolu taşıma

Set-PopSettings -LogFileLocation "$path\Logging\Pop3"

#IMAP log yolu taşıma

Set-ImapSettings -LogFileLocation "$path\Logging\Imap4"

#Exchange Performans log yolu taşıma

logman -stop ExchangeDiagnosticsDailyPerformanceLog
logman -update ExchangeDiagnosticsDailyPerformanceLog -o "$path\Exchange\Microsoft\Exchange Server\V15\Logging\Diagnostics\DailyPerformanceLogs\ExchangeDiagnosticsDailyPerformanceLog"
logman -start ExchangeDiagnosticsDailyPerformanceLog
logman -stop ExchangeDiagnosticsPerformanceLog
logman -update ExchangeDiagnosticsPerformanceLog -o "$path\Exchange\Microsoft\Exchange Server\V15\Logging\Diagnostics\PerformanceLogsToBeProcessed\ExchangeDiagnosticsPerformanceLog"
logman -start ExchangeDiagnosticsPerformanceLog
Stop-Service MSExchangeDiagnostics
$registryPath = "HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Diagnostics"
$propertyName = "LogFolderPath"
$propertyValue = "D:\LOG\AppLogs\V15\Logging\Diagnostics"
New-ItemProperty -Path $registryPath -Name $propertyName -Value $propertyValue -PropertyType String -Force
Start-Service MSExchangeDiagnostics

Bu işlemlerin ardından ilk script’i kullanarak log path’lerinin değişip değişmediğini doğrulayabilirsiniz. Faydalı olması dileğiyle kolaylıklar.

İlgili Makaleler

2 Yorum

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Başa dön tuşu