OpenTelemetry 를 사용하여 Windows 이벤트 로그 수집하기
OpenTelemetry (OTEL) 수집기를 사용하면 Windows 기반 운영 체제에서 로그를 수집하여 Instana 으로 전송할 수 있습니다. Instana 다양한 방식을 통해 OTEL 로그를 수신할 수 있습니다.
자세한 내용은 ‘ OpenTelemetry 데이터 수집 구성’을 참조하십시오.
서비스에 대한 로그 메시지 상관 관계 설정 방법에 대한 자세한 내용은 OpenTelemetry service-correlation을 참조하십시오.
OpenTelemetry 를 통해 로그를 수집하기 위한 전제 조건
OpenTelemetry, 를 통해 Instana 에 로그를 수집하려면 애드온이나 추가 구성이 필요할 수 있습니다. 자세한 내용은 ‘라이선스 및 권한 요구 사항 ’을 참조하십시오.
Windows 이벤트 로그의 유형
Windows 이벤트 로그 수신기는 Windows 이벤트 로그 API 에서 다음 내용을 포함한 로그를 수집합니다
Windows 로그
- 애플리케이션
- 보안
- 설정
- 시스템
- 전달된 이벤트 수
애플리케이션 및 서비스 로그
Windows 이벤트 로그 수집
모니터링 및 분석을 위해 Windows 이벤트 로그를 수집하고 이를 Instana 으로 전송하도록 OpenTelemetry 수집기를 구성해야 합니다.
Windows 로그용 OTEL 수집기 구성
Windows 서버 구성에 따라 Windows 릴리스 페이지에서 0.110.0 이상 버전의 실행 파일( otelcol-contrib 바이너리 파일)을 다운로드하십시오. 이 OTEL Collector Contrib 패키지에는 로그를 수집하여 Instana 로 전송하는 데 필요한, 커뮤니티 주도의 오픈 소스 기능들이 포함되어 있습니다. OTEL Collector를 구성하여 리시버 windowseventlog (receiver)를 통해 Windows 이벤트 로그 데이터를 수집하고, 해당 로그 데이터를 Instana 에이전트의 OTLP 엔드포인트로 전달하도록 설정합니다. OTEL 수집기를 구성하려면 다음 예시를 참조하세요.
Instana 에이전트와 TLS 암호화 방식을 사용하여 통신하려면, 에이전트 엔드포인트에 대한 TLS 암호화를 설정하는 단계를 완료하십시오.
receivers:
## [REQUIRED] Configures the capture of Windows Event Logs from the "application" channel
windowseventlog:
channel: application
attributes:
type: windows
exporters:
## [REQUIRED] The Instana Agent supports GRPC payloads
otlp/instanaAgent:
## Be sure to set the appropriate HOST:PORT combination.
## Note: The GRPC port will be 4317 (unless port-forwarding is used to change this).
endpoint: "INSTANA_AGENT_HOST:INSTANA_AGENT_GRPC_PORT"
## TLS encryption is disabled in this example.
tls:
insecure: true
processors:
## [OPTIONAL] This is an example log severity parser that sets the **severity_text** field in the log payload, each runs in-order such that the highest matching severity is set.
## Note: If the OpenTelemetry Collector does not set log severity, then the severity is set by Instana when analyzing the log message.
transform/set_log_severity:
log_statements:
- context: log
statements:
- set(severity_text, "Info") where IsMatch(body.string, ".*INFO.*")
- set(severity_text, "Warn") where IsMatch(body.string, ".*WARN.*")
- set(severity_text, "Error") where IsMatch(body.string, ".*ERROR.*")
- set(severity_text, "Fatal") where IsMatch(body.string, ".*FATAL.*")
## [REQUIRED] Logs must be sent in batches for performance reasons.
## Note: No additional `batch` processor configuration is provided since configuration depends on the user scenario.
batch: {}
## See the page on best practices for Instana OpenTelemetry logging for more information.
service:
pipelines:
## [REQUIRED] Sample logs pipeline using the above configurations.
logs:
receivers: [windowseventlog]
processors: [transform/set_log_severity, batch]
exporters: [otlp/instanaAgent]
사용자 지정 애플리케이션 및 서비스 로그 생성
때때로 OTEL 콜렉터에서 애플리케이션 및 서비스 로그를 콜렉션에 사용할 수 없습니다. 이 경우 다음 명령을 실행하여 사용자 정의된 애플리케이션 및 서비스 로그를 작성해야 합니다.
New-EventLog -LogName "Customlog" -Source "MySource"
Write-EventLog -LogName "Customlog" -Source "MySource" -EntryType Error -EventId 1001 -Message "This is an error message body for testing."
PowerShell 의 New-EventLog cmdlet은 새 이벤트 로그를 작성합니다. 그러나 본문과 심각도가 있는 이벤트를 직접 작성하지는 않습니다. 따라서 본문 및 심각도를 포함하여 특정 세부사항이 있는 이벤트를 작성하려면 Write-EventLog cmdlet을 사용해야 합니다.
OTEL 수집기 데이터 가져오기
OTEL 콜렉터를 사용하여 관리 또는 비관리 사용자로 데이터를 유입할 수 있습니다.
관리자 권한이 없는 사용자로 데이터 입력하기
비관리 사용자로서 OTEL 콜렉터를 사용하여 데이터를 수집하려면 다음 단계를 완료하십시오.
- Windows 시스템 또는 VM 에서 ‘시작’ > ‘설정’ > ‘계정’을 선택합니다.
- 이 PC에 다른 사용자 추가를 클릭하십시오.
- 로컬 사용자 및 그룹 메뉴에서 사용자 를 마우스 오른쪽 단추로 클릭하고 새 사용자 작성을 선택하십시오.
- 이벤트 로그 판독기 그룹에 새로 작성된 사용자를 추가하십시오.
- 관리 사용자로 데이터 인그레션 섹션에 언급된 단계를 수행하십시오.
관리자 계정으로 데이터 입력
관리 사용자로서 OTEL 콜렉터를 사용하여 데이터를 수집하려면 다음 단계를 완료하십시오.
Windows 서버 구성에 따라 Windows 릴리스 페이지에서 압축된 tarball(
.tar.gz) 형태로 제공되는 실행 파일(바이너리 파일)을 다운로드하십시오. 모든 OpenTelemetry Collector 릴리스에는 압축을 해제한 후 실행할 수 있는 파일이otelcol.exe포함되어 있습니다.64비트 OS, x64-based 프로세서의 경우 최신
otelcol-contrib_*_windows_amd64.tar.gz파일을 다운로드하십시오.OTEL 콜렉터를 시작하려면 실행 가능 2진파일을 실행하고
opentelemetry-collector-config.yaml를 매개변수로 전달하십시오.C:\Users\Administrator>otelcol-contrib.exe --config opentelemetry-collector-config.yaml테스트 목적으로 맞춤형 Windows 애플리케이션 이벤트 로그를 생성하려면 다음 명령을 실행하십시오:
C:\Users\Administrator>eventcreate /t ERROR /id 123 /L APPLICATION /D "Test log generation_05:52"Windows 의 모든 이벤트 애플리케이션 로그를 가져오려면 다음
opentelemetry-collector-config.yaml파일의 구성 필드를 수정하십시오:receivers: windowseventlog: channel: applicationWindows 의 모든 이벤트 보안 로그를 가져오려면 다음 파일의
opentelemetry-collector-config.yaml구성 필드를 수정하십시오:receivers: windowseventlog: channel: security다른 로그 유형을 원하는 경우 필요한 로그 유형으로
channel필드를 수정하십시오.