Central Binary Log File <centralBinaryLogFile>

개요

요소는 <centralBinaryLogFile> 서버의 모든 사이트에 대한 중앙 이진 로그 설정을 지정합니다.

참고

요소의 특성이 적용되도록 부모 <log> 요소의 centralLogFileMode 특성을 <centralW3CLogFile>CentralBinary로 설정해야 합니다. 요소의 <log>centralLogFileMode 특성이 CentralW3C 또는 Site로 설정된 경우 요소의 <centralW3CLogFile> 특성은 무시됩니다.

참고

W3C 형식의 로그 파일은 대부분의 로그 구문 분석 유틸리티에서 처리할 수 있는 텍스트 기반 파일입니다. 이진 로그 파일은 Microsoft의 LogParser 유틸리티와 같이 해당 형식으로 로그 파일을 처리할 수 있는 애플리케이션을 사용해야 하는 전용 스토리지 형식을 사용합니다.

호환성

버전 참고
IIS 10.0 <centralBinaryLogFile> 요소가 IIS 10.0에서 수정되지 않았습니다.
IIS 8.5 <centralBinaryLogFile> 요소가 IIS 8.5에서 수정되지 않았습니다.
IIS 8.0 <centralBinaryLogFile> 요소가 IIS 8.0에서 수정되지 않았습니다.
IIS 7.5 <centralBinaryLogFile> 요소가 IIS 7.5에서 수정되지 않았습니다.
IIS 7.0 <centralBinaryLogFile> 요소의 <log> 요소는 IIS 7.0에서 도입되었습니다.
IIS 6.0 요소는 <log> IIS 6.0 CentralBinaryLoggingEnabled 플래그를 대체합니다.

설치 프로그램

<centralBinaryLogFile> 요소의 <log> 요소는 IIS 7의 기본 설치에 포함됩니다.

방법

서버에 중앙 이진 로깅을 사용하도록 설정하는 방법

  1. IIS(인터넷 정보 서비스) 관리자를 엽니다.

    • Windows Server 2012 또는 Windows Server 2012 R2를 사용하는 경우:

      • 작업 표시줄에서 서버 관리자 클릭하고 도구를 클릭한 다음 IIS(인터넷 정보 서비스) 관리자를 클릭합니다.
    • Windows 8 또는 Windows 8.1 사용하는 경우:

      • Windows 키를 누른 채로 문자 X를 누른 다음 제어판 클릭합니다.
      • 관리 도구를 클릭한 다음 IIS(인터넷 정보 서비스) 관리자를 두 번 클릭합니다.
    • Windows Server 2008 또는 Windows Server 2008 R2를 사용하는 경우:

      • 작업 표시줄에서 시작을 클릭하고 관리 도구를 가리킨 다음 IIS(인터넷 정보 서비스) 관리자를 클릭합니다.
    • Windows Vista 또는 Windows 7을 사용하는 경우:

      • 작업 표시줄에서 시작을 클릭한 다음 제어판 클릭합니다.
      • 관리 도구를 두 번 클릭한 다음 IIS(인터넷 정보 서비스) 관리자를 두 번 클릭합니다.
  2. 연결 창에서 서버 이름을 클릭합니다.

  3. 서버의 창에서 로깅을 두 번 클릭합니다.
    서버 홈 페이지를 표시하는 I S 관리자 창의 스크린샷 로깅 아이콘이 강조 표시되어 있습니다.

  4. 로깅 페이지의 로그 파일당 하나 아래에서 드롭다운 목록에서 서버를 선택한 다음 서식 드롭다운 목록에서 이진을 선택합니다.
    로깅 페이지를 표시하는 I S 관리자의 스크린샷.

  5. 작업 창에서 적용을 클릭합니다.

구성

특성

attribute Description
directory 선택적 문자열 특성입니다.

로그 항목이 기록되는 디렉터리를 지정합니다.
enabled 선택적 부울 특성입니다.

중앙 이진 로깅을 사용할 수 있는지 여부를 지정합니다. 또한 중앙 이진 로깅을 완전히 사용하도록 설정하려면 centralLogFileModeCentralBinary 로 설정해야 합니다.

기본값은 false입니다.
localTimeRollover 선택적 부울 특성입니다.

현지 시간 또는 UTC(협정 세계시)에 따라 새 로그 파일을 만들지 여부를 지정합니다. true 값은 새 로그 파일이 현지 시간을 기준으로 한다는 것을 의미합니다. false는 UTC를 기반으로 한다는 것을 의미합니다.

기본값은 false입니다.
period 선택적 열거형 특성입니다.

로그 파일 내용을 지워야 하는 빈도를 지정합니다.

period 특성은 다음과 같은 가능한 값 중 하나일 수 있습니다.

기본값은 Daily입니다.
Description
MaxSize 로그 파일이 truncateSize 특성에 지정된 크기에 도달할 때마다 로그 파일이 지워집니다.

숫자 값은 입니다 0.
Daily 로그 파일은 매일 지워집니다.

숫자 값은 입니다 1.
Weekly 로그 파일은 일주일에 한 번 지워집니다.

숫자 값은 입니다 2.
Monthly 로그 파일은 한 달에 한 번 지워집니다.

숫자 값은 입니다 3.
Hourly 로그 파일은 매시간 지워집니다.

숫자 값은 입니다 4.
truncateSize 선택적 int64 특성입니다.

로그 파일 내용을 잘라야 하는 크기를 지정합니다. 기간 특성의 값이 maxSize인 경우 이 특성을 설정해야 합니다. 크기는 1048576(1메가바이트)와 4294967295(4GB) 사이여야 합니다.

기본값은 (20MB)입니다 20971520 .

자식 요소

없음

구성 샘플

다음 구성 샘플은 IIS가 중앙 이진 로깅을 사용하도록 지정하고 매일 이진 로그 파일 회전을 구성합니다.

<log centralLogFileMode="CentralBinary">
   <centralBinaryLogFile enabled="true" directory="%SystemDrive%\inetpub\logs\LogFiles" period="Daily" />
   <centralW3CLogFile enabled="true" directory="%SystemDrive%\inetpub\logs\LogFiles" />
</log>

샘플 코드

다음 코드 샘플은 IIS가 중앙 이진 로깅을 사용하도록 지정하고 매일 이진 로그 파일 회전을 구성합니다.

AppCmd.exe

appcmd.exe set config -section:system.applicationHost/log /centralLogFileMode:"CentralBinary" /commit:apphost

appcmd.exe set config -section:system.applicationHost/log /centralBinaryLogFile.period:"Daily" /commit:apphost

참고

AppCmd.exe 사용하여 이러한 설정을 구성할 때 commit 매개 변수 apphost 를 로 설정해야 합니다. 그러면 구성 설정이 ApplicationHost.config 파일의 적절한 위치 섹션에 커밋됩니다.

C#

using System;
using System.Text;
using Microsoft.Web.Administration;

internal static class Sample
{
   private static void Main()
   {
      using (ServerManager serverManager = new ServerManager())
      {
         Configuration config = serverManager.GetApplicationHostConfiguration();

         ConfigurationSection logSection = config.GetSection("system.applicationHost/log");
         logSection["centralLogFileMode"] = @"CentralBinary";
         ConfigurationElement centralBinaryLogFileElement = logSection.GetChildElement("centralBinaryLogFile");
         centralBinaryLogFileElement["period"] = @"Daily";

         serverManager.CommitChanges();
      }
   }
}

VB.NET

Imports System
Imports System.Text
Imports Microsoft.Web.Administration

Module Sample

   Sub Main()
      Dim serverManager As ServerManager = New ServerManager
      Dim config As Configuration = serverManager.GetApplicationHostConfiguration

      Dim logSection As ConfigurationSection = config.GetSection("system.applicationHost/log")
      logSection("centralLogFileMode") = "CentralBinary"
      Dim centralBinaryLogFileElement As ConfigurationElement = logSection.GetChildElement("centralBinaryLogFile")
      centralBinaryLogFileElement("period") = "Daily"

      serverManager.CommitChanges()
   End Sub

End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";

var logSection = adminManager.GetAdminSection("system.applicationHost/log", "MACHINE/WEBROOT/APPHOST");
logSection.Properties.Item("centralLogFileMode").Value = "CentralBinary";
var centralBinaryLogFileElement = logSection.ChildElements.Item("centralBinaryLogFile");
centralBinaryLogFileElement.Properties.Item("period").Value = "Daily";

adminManager.CommitChanges();

VBScript

Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"

Set logSection = adminManager.GetAdminSection("system.applicationHost/log", "MACHINE/WEBROOT/APPHOST")
logSection.Properties.Item("centralLogFileMode").Value = "CentralBinary"
Set centralBinaryLogFileElement = logSection.ChildElements.Item("centralBinaryLogFile")
centralBinaryLogFileElement.Properties.Item("period").Value = "Daily"

adminManager.CommitChanges()