ServiceWatch Agent 사용하기
사용자는 Virtual Server/GPU Server/Bare Metal Server 등에서 ServiceWatch Agent를 설치하여 사용자 정의 지표와 로그를 수집할 수 있습니다.
ServiceWatch Agent
서버에 ServiceWatch의 사용자 정의 지표 및 로그 수집을 위해 설치해야 하는 Agent는 크게 2가지로 나눌 수 있습니다. Prometheus Exporter와 Open Telemetry Collector입니다.
ServiceWatch Agent는 Prometheus Exporter가 제공하는 지표를 수집하여 ServiceWatch로 전송하므로, Exporter가 먼저 설치되어 있어야 합니다.
| 구분 | 상세 설명 |
|---|---|
| Prometheus Exporter | 특정 애플리케이션이나 서비스의 메트릭을 Prometheus가 스크랩(scrape)할 수 있는 형식으로 제공
|
| Open Telemetry Collector | 분산 시스템의 메트릭, 로그와 같은 텔레메트리 데이터를 수집하고, 처리(필터링, 샘플링 등)한 후, 여러 백엔드(예: Prometheus, Jaeger, Elasticsearch 등)로 내보내는 중앙 집중식 수집기 역할
|
ServiceWatch Agent를 통해 서버의 로그 파일을 ServiceWatch에 연계하기 위해서는 로그 그룹과 로그 그룹 내 로그 스트림을 먼저 생성해야 합니다.
- 로그 그룹 생성 및 로그 스트림 생성에 대한 자세한 내용은 로그를 참고하세요.
Prometheus Exporter 종류
수집하려는 지표와 서버의 OS에 따라 다음 Exporter를 사용합니다.
| Exporter | 수집 지표 | 대상 서버 | 설치 가이드 |
|---|---|---|---|
| Node Exporter | Linux 서버의 OS 지표 |
| Virtual Server > ServiceWatch Agent |
| Windows Exporter | Windows 서버의 OS 지표 |
| Virtual Server > ServiceWatch Agent |
| DCGM Exporter | GPU 지표
|
| GPU Server > ServiceWatch Agent |
ServiceWatch Agent는 Prometheus Exporter가 제공하는 지표를 수집하여 ServiceWatch로 전송하므로, Exporter가 먼저 설치되어 있어야 합니다.
설치 및 설정 순서
ServiceWatch Agent는 다음 순서로 설치하고 설정합니다.
| 단계 | 작업 | 상세 |
|---|---|---|
| 0단계 | 환경에 맞는 Prometheus Exporter 설치 | Prometheus Exporter 종류 |
| 1단계 | ServiceWatch Agent와 ServiceWatch 간 통신을 위한 네트워크 설정 | ServiceWatch Agent를 위한 사전 환경 설정 |
| 2단계 | Agent 파일 다운로드 및 설정 파일 정의 | ServiceWatch를 위한 Open Telemetry Collector 설정 |
| 3단계 | Agent 실행 및 중지 | ServiceWatch를 위한 Open Telemetry Collector 실행 |
ServiceWatch Agent를 위한 사전 환경 설정
ServiceWatch Agent와 ServiceWatch 간 통신을 위하여 네트워크 설정이 필요합니다. ServiceWatch Agent가 수집한 데이터를 ServiceWatch로 전송하는 방식은 Internet Gateway 활용 방식과 PrivateLink 활용 방식 두 가지가 있으며, 환경에 맞는 방식을 선택하여 설정합니다.
| 통신 방식 | 상세 설명 | 지원 오퍼링/리전 | 필요한 설정 |
|---|---|---|---|
| Internet Gateway 활용 방식 | Internet Gateway를 통해 ServiceWatch OpenAPI Endpoint로 데이터를 전송 |
| Security Group 규칙, Internet Gateway Firewall 규칙 |
| PrivateLink 활용 방식 | VPC에 생성한 PrivateLink Endpoint를 통해 내부 네트워크로 데이터를 전송 |
| PrivateLink Endpoint, Security Group 규칙, hosts 파일 |
Internet Gateway 활용 방식
Internet Gateway를 통해 ServiceWatch로 데이터를 전송하는 경우 Security Group과 Firewall 규칙을 추가해야 합니다.
방화벽 해제는 Support Center > 문의하기를 통해 요청하세요.
Security Group 규칙 추가
- Virtual Server/GPU Server에 설치된 ServiceWatch Agent에서 ServiceWatch로 수집된 데이터를 전송하기 위해 아래와 같이 Security Group에 규칙을 추가해야 합니다.
방향 유형 포트 대상 주소 Outbound 사용자 지정 TCP 443 ServiceWatch OpenAPI Endpoint IP 주소 표. ServiceWatch Agent 통신을 위한 Security Group 규칙
- Virtual Server/GPU Server에 설치된 ServiceWatch Agent에서 ServiceWatch로 수집된 데이터를 전송하기 위해 아래와 같이 Security Group에 규칙을 추가해야 합니다.
Firewall 규칙 추가
- VPC의 Internet Gateway에 방화벽을 사용으로 설정한 경우 아래와 같이 Firewall 규칙을 추가해야 합니다.
방향 유형 포트 동작 출발지 주소 목적지 주소 Outbound TCP 443 Allow Virtual Server 생성 시, 할당된 Private IP 주소. Virtual Server Private IP 주소는 Virtual Server 상세 정보 확인하기에서 확인할 수 있습니다. ServiceWatch OpenAPI Endpoint IP 주소 표. ServiceWatch Agent 통신을 위한 Internet Gateway Firewall 규칙
- VPC의 Internet Gateway에 방화벽을 사용으로 설정한 경우 아래와 같이 Firewall 규칙을 추가해야 합니다.
PrivateLink 활용 방식
PrivateLink를 사용하면 ServiceWatch Agent가 수집한 데이터를 인터넷을 경유하지 않고 Samsung Cloud Platform 내부 네트워크로 전송할 수 있습니다. 데이터가 내부 네트워크만 이용하므로 보안성이 높고, 퍼블릭 IP와 NAT, Internet Gateway가 필요하지 않습니다. 따라서 Internet Gateway Firewall 규칙도 추가하지 않습니다.
- PrivateLink Endpoint 생성
- VPC에서 ServiceWatch로 연결할 PrivateLink Endpoint를 생성합니다. 서비스 구분에서 Samsung Cloud Platform 제공 서비스를 선택한 후, PrivateLink Service 목록에서 ServiceWatch_GLOBAL1을 선택합니다.
- 생성 절차에 대한 자세한 내용은 VPC > PrivateLink Endpoint 생성하기를 참고하세요.
또한 PrivateLink Endpoint에 Security Group을 지정하지 않으면 모든 접속이 차단되므로, 아래 2번의 Security Group 규칙을 반드시 설정하세요.
Security Group 규칙 추가
- ServiceWatch Agent에서 PrivateLink Endpoint를 통해 데이터를 전송하기 위해 아래와 같이 Security Group에 규칙을 추가해야 합니다.
설정 대상 방향 유형 포트 대상 주소 Virtual Server/GPU Server의 Security Group Outbound 사용자 지정 TCP 443 PrivateLink Endpoint에 할당된 IP 주소 PrivateLink Endpoint의 Security Group Inbound 사용자 지정 TCP 443 Virtual Server/GPU Server의 IP 주소 표. PrivateLink 활용 방식의 Security Group 규칙
- ServiceWatch Agent에서 PrivateLink Endpoint를 통해 데이터를 전송하기 위해 아래와 같이 Security Group에 규칙을 추가해야 합니다.
hosts 파일 설정
- ServiceWatch Agent는 ServiceWatch OpenAPI Endpoint 도메인으로 데이터를 전송하므로, 서버에서 해당 도메인이 PrivateLink Endpoint IP 주소로 해석되도록 hosts 파일을 설정해야 합니다.
- hosts 파일의 위치는 OS에 따라 다릅니다.
- Linux:
/etc/hosts - Windows:
C:\Windows\System32\drivers\etc\hosts배경색 변경# PrivateLink Endpoint IP가 192.168.0.3일때, 192.168.0.3 servicewatch.kr-west1.e.samsungsdscloud.com# PrivateLink Endpoint IP가 192.168.0.3일때, 192.168.0.3 servicewatch.kr-west1.e.samsungsdscloud.com코드블록. hosts 파일 설정 예시
- Linux:
ServiceWatch OpenAPI Endpoint IP 주소
ServiceWatch Agent가 ServiceWatch로 수집된 데이터를 전송하기 위해 필요한 Endpoint IP 주소는 다음과 같습니다.
| 오퍼링 | 리전 | URL | IP 주소 |
|---|---|---|---|
| For Enterprise | kr-west1 | https://servicewatch.kr-west1.e.samsungsdscloud.com | 112.107.105.24 |
| For Enterprise | kr-east1 | https://servicewatch.kr-east1.e.samsungsdscloud.com | 112.107.105.68 |
| Soverign | kr-south1 | https://servicewatch.kr-south1.g.samsungsdscloud.com | 10.150.58.135 |
| Soverign | kr-south2 | https://servicewatch.kr-south2.g.samsungsdscloud.com | 10.150.90.135 |
| Soverign | kr-west1 | https://servicewatch.kr-west1.k.samsungsdscloud.com | 112.107.105.132 |
ServiceWatch를 위한 Open Telemetry Collector 설정
서버에서 ServiceWatch 지표와 로그 수집을 위한 Open Telemetry Collector를 사용하기 위해 아래의 순서에 따라 설치합니다.
1. Agent 파일 다운로드
ServiceWatch Agent 파일 다운로드 URL에서 Agent 파일을 다운로드합니다.
또한 ServiceWatch의 ShowAgentDownloadLink API로도 확인 가능합니다. 자세한 내용은 ServiceWatch API Reference를 참고하세요.
wget [ServiceWatch Agent 파일 다운로드 URL]wget [ServiceWatch Agent 파일 다운로드 URL]2. Agent 파일 구성 확인
다운로드한 Agent 파일의 구성은 아래와 같이 확인할 수 있습니다.
- ServiceWatch를 위한 Agent 파일을 압축 해제합니다.배경색 변경
unzip ServiceWatch_Agent.zipunzip ServiceWatch_Agent.zip코드블록. ServiceWatch를 위한 Agent 파일 압축 해제 배경색 변경README.md otelcontribcol_linux_amd64 otelcontribcol_windows_amd64.exe servicewatch-agent-manager-linux-amd64 servicewatch-agent-manager-windows-amd64.exe os-metrics-min-examples/ ├─ agent.json ├─ metric.json └─ log.json os-metrics-all-examples/ gpu-metrics-min-examples/ gpu-metrics-all-examples/ only-log-without-timestamp-examples/README.md otelcontribcol_linux_amd64 otelcontribcol_windows_amd64.exe servicewatch-agent-manager-linux-amd64 servicewatch-agent-manager-windows-amd64.exe os-metrics-min-examples/ ├─ agent.json ├─ metric.json └─ log.json os-metrics-all-examples/ gpu-metrics-min-examples/ gpu-metrics-all-examples/ only-log-without-timestamp-examples/코드블록. ServiceWatch Agent 압축 해제 결과 구분 상세 설명 README.md Agent 사용 방법 안내 파일 otelcontribcol_linux_amd64 ServiceWatch용 Open Telemetry Collector for Linux otelcontribcol_windows_amd64.exe ServiceWatch용 Open Telemetry Collector for Windows servicewatch-agent-manager-linux-amd64 ServiceWatch Agent Manager for Linux servicewatch-agent-manager-windows-amd64.exe ServiceWatch Agent Manager for Windows 예시 설정 파일 폴더 각 폴더에 agent.json과 용도에 맞는metric.json,log.json예시 파일이 존재함os-metrics-min-examples: Node Exporter를 활용한 최소 지표 설정 예시
os-metrics-all-examples: Node Exporter를 활용한 memory/filesystem Collector 지표 설정 예시
gpu-metrics-min-examples: DCGM Exporter를 활용한 최소 지표 설정 예시
gpu-metrics-all-examples: DCGM Exporter를 활용한 주요 지표 설정 예시
only-log-without-timestamp-examples: 타임스탬프 파싱 없이 로그만 수집하는 설정 예시
표. ServiceWatch를 위한 Agent 파일 구성 - ServiceWatch Agent를 사용하는 환경이 Linux OS인 경우, 아래와 같이 실행 권한을 부여해야 합니다.배경색 변경
chmod +x otelcontribcol_linux_amd64 chmod +x servicewatch-agent-manager-linux-amd64chmod +x otelcontribcol_linux_amd64 chmod +x servicewatch-agent-manager-linux-amd64코드블록. ServiceWatch를 위한 Agent 파일 실행 권한 부여
3. agent.json 설정
ServiceWatch Agent Manager의 Agent 설정 파일(agent.json)을 정의합니다.
| 구분 | 상세 설명 |
|---|---|
| namespace | 사용자 정의 지표를 위한 사용자 정의 네임 스페이스
|
| accessKey | IAM 인증키 Access Key |
| accessSecret | IAM 인증키 Secret Key |
| resourceId | 서버의 Samsung Cloud Platform에서의 자원 ID
|
| openApiEndpoint | 리전/오퍼링별 ServiceWatch OpenAPI Endpoint
|
| telemetryPort | ServiceWatch Agent의 Telemetry Port
|
{
"namespace": "swagent-windows", # 사용자 정의 지표를 위한 사용자 정의 네임 스페이스
"accessKey": "testKey", # IAM 인증키 Access Key
"accessSecret": "testSecret", # IAM 인증키 Secret Key
"resourceId": "resourceID", # 서버의 Samsung Cloud Platform에서의 자원 ID
"openApiEndpoint": "https://servicewatch.kr-west1.e.samsungsdscloud.com", # 리전/환경별 ServiceWatch OpenAPI Endpoint
"telemetryPort": 8889 # ServiceWatch Agent의 Telemetry Port (기본은 8888 Port이며, 위 예시는 8888 Port가 사용 중이어서 8889로 지정한 경우)
}{
"namespace": "swagent-windows", # 사용자 정의 지표를 위한 사용자 정의 네임 스페이스
"accessKey": "testKey", # IAM 인증키 Access Key
"accessSecret": "testSecret", # IAM 인증키 Secret Key
"resourceId": "resourceID", # 서버의 Samsung Cloud Platform에서의 자원 ID
"openApiEndpoint": "https://servicewatch.kr-west1.e.samsungsdscloud.com", # 리전/환경별 ServiceWatch OpenAPI Endpoint
"telemetryPort": 8889 # ServiceWatch Agent의 Telemetry Port (기본은 8888 Port이며, 위 예시는 8888 Port가 사용 중이어서 8889로 지정한 경우)
}4. metric.json 설정
ServiceWatch로 지표를 수집하기 위한 Metric 설정 파일(metric.json)을 정의합니다.
- Agent를 통해 지표 수집하고자 하는 경우 metric.json을 설정합니다.
구분 상세 설명 prometheus > scrape_configs > targets 지표 수집 대상의 Endpoint - 서버의 경우 같은 서버에 Prometheus Exporter 설치하므로 해당 endpoint로 설정
- 예시: localhost:9100
prometheus > scrape_configs > jobName Job Name 설정. 보통 지표 수집 시 사용하는 Prometheus Exporter 종류로 설정 - 예시: node-exporter
metricMetas > metricName 수집하고자 하는 지표 이름 설정. 지표명은 영문, 숫자, 특수문자( _)를 포함하여 3~128자로 작성해야하며, 영문으로 시작해야 합니다.- 예시: node_cpu_seconds_total
metricMetas > dimensions Exporter의 지표 데이터의 출처를 식별하기 위해 제공하는 Collector의 레이블 중 Console에 시각화하여 보여주기 위한 레이블을 설정. 수집한 지표를 Console에 시각화하여 보여줄 때, 차원(dimensions) 설정에 따라 조합하여 표시. - Exporter가 실제로 수집하는 레이블명과 대소문자까지 일치하도록 설정
- 예시: Node Exporter의 Memory Collector의 지표와 같이 특별한 레이블을 제공하지 않는 경우에는 resource_id로 설정
- 예시: Node Exporter의 Filesystem Collector 지표는 파일시스템이 시스템상에 마운트된 경로를 나타내는 mountpoint로 차원(dimensions) 설정할 수 있음
metricMetas > unit 지표의 단위 설정 가능 - 예시: Bytes, Count 등
metricMetas > aggregationMethod 지정한 차원(dimensions) 기준으로 집계하는 방법 - 예시: SUM, MAX, MIN, COUNT 중 선택
metricMetas > descriptionKo 수집하는 지표에 대한 국문 설명 metricMetas > descriptionEn 수집하는 지표에 대한 영문 설명 표. metric.json 설정 파일 항목
dimensions에 설정한 레이블명은 Exporter가 실제로 수집하는 레이블명과 대소문자까지 정확히 일치해야 합니다. 예를 들어 Hostname과 hostname은 서로 다른 레이블로 취급되어 지표가 정상적으로 수집되지 않습니다.또한 동일한 Exporter라도 설치한 버전에 따라 레이블명이 다를 수 있습니다. 따라서
metric.json을 작성하기 전에 Exporter에서 실제로 수집되는 레이블명을 확인한 후 dimensions에 설정하세요.Exporter가 수집하는 레이블명은 Exporter의 지표 Endpoint를 조회하여 확인할 수 있습니다.
curl http://localhost:9100/metrics | grep node_filesystem_size_bytescurl http://localhost:9100/metrics | grep node_filesystem_size_bytes{
"prometheus": {
"scrape_configs": {
"targets": [
"localhost:9100" # 서버 내 설치한 Prometheus Exporter의 Endpoint
],
"jobName": "node-exporter" # 보통 설치한 Exporter의 이름으로 설정
}
},
"metricMetas": [
{
"metricName": "node_memory_MemTotal_bytes", # Prometheus Exporter로부터 수집되는 지표 중 ServiceWatch로 연계하고자 하는 지표명 설정
"dimensions": [
[
"resource_id" # Node Exporter의 지표 데이터의 출처를 식별하기 위해 제공하는 Collector의 레이블 중 Console에 시각화하여 보여주기 위한 레이블을 설정
# 해당 Memory 관련 지표와 같이 특별한 레이블을 제공하지 않는 경우에는 resource_id로 설정
]
],
"unit": "Bytes", # 수집 지표 데이터의 단위
"aggregationMethod": "SUM", # 집계 방법
"descriptionKo": "서버의 총 물리적 메모리 크기", # 지표의 국문 설명
"descriptionEn": "node memory total bytes" # 지표의 영문 설명
},
{
"metricName": "node_filesystem_size_bytes", # Prometheus Exporter로부터 수집되는 지표 중 ServiceWatch로 연계하고자 하는 지표명 설정
"dimensions": [
[
"mountpoint" # Node Exporter의 지표 데이터의 출처를 식별하기 위해 제공하는 Collector의 레이블 중 Console에 시각화하여 보여주기 위한 레이블을 설정
# 해당 Filesystem 관련 지표의 파일시스템이 시스템상에 마운트된 경로를 나타내는 mountpoint로 차원(dimensions) 설정
]
],
"unit": "Bytes",
"aggregationMethod": "SUM",
"descriptionKo": "node filesystem size bytes",
"descriptionEn": "node filesystem size bytes"
},
{
"metricName": "node_memory_MemAvailable_bytes",
"dimensions": [
[
"resource_id"
]
],
"unit": "Bytes",
"aggregationMethod": "SUM",
"descriptionKo": "node memory available bytes",
"descriptionEn": "node memory available bytes"
},
{
"metricName": "node_filesystem_avail_bytes",
"dimensions": [
[
"mountpoint"
]
],
"unit": "Bytes",
"aggregationMethod": "SUM",
"descriptionKo": "node filesystem available bytes",
"descriptionEn": "node filesystem available bytes"
}
]
}{
"prometheus": {
"scrape_configs": {
"targets": [
"localhost:9100" # 서버 내 설치한 Prometheus Exporter의 Endpoint
],
"jobName": "node-exporter" # 보통 설치한 Exporter의 이름으로 설정
}
},
"metricMetas": [
{
"metricName": "node_memory_MemTotal_bytes", # Prometheus Exporter로부터 수집되는 지표 중 ServiceWatch로 연계하고자 하는 지표명 설정
"dimensions": [
[
"resource_id" # Node Exporter의 지표 데이터의 출처를 식별하기 위해 제공하는 Collector의 레이블 중 Console에 시각화하여 보여주기 위한 레이블을 설정
# 해당 Memory 관련 지표와 같이 특별한 레이블을 제공하지 않는 경우에는 resource_id로 설정
]
],
"unit": "Bytes", # 수집 지표 데이터의 단위
"aggregationMethod": "SUM", # 집계 방법
"descriptionKo": "서버의 총 물리적 메모리 크기", # 지표의 국문 설명
"descriptionEn": "node memory total bytes" # 지표의 영문 설명
},
{
"metricName": "node_filesystem_size_bytes", # Prometheus Exporter로부터 수집되는 지표 중 ServiceWatch로 연계하고자 하는 지표명 설정
"dimensions": [
[
"mountpoint" # Node Exporter의 지표 데이터의 출처를 식별하기 위해 제공하는 Collector의 레이블 중 Console에 시각화하여 보여주기 위한 레이블을 설정
# 해당 Filesystem 관련 지표의 파일시스템이 시스템상에 마운트된 경로를 나타내는 mountpoint로 차원(dimensions) 설정
]
],
"unit": "Bytes",
"aggregationMethod": "SUM",
"descriptionKo": "node filesystem size bytes",
"descriptionEn": "node filesystem size bytes"
},
{
"metricName": "node_memory_MemAvailable_bytes",
"dimensions": [
[
"resource_id"
]
],
"unit": "Bytes",
"aggregationMethod": "SUM",
"descriptionKo": "node memory available bytes",
"descriptionEn": "node memory available bytes"
},
{
"metricName": "node_filesystem_avail_bytes",
"dimensions": [
[
"mountpoint"
]
],
"unit": "Bytes",
"aggregationMethod": "SUM",
"descriptionKo": "node filesystem available bytes",
"descriptionEn": "node filesystem available bytes"
}
]
}- 자원명 표기를 위해서는 아래와 같이 commonLabels에 resource_name을 설정하고, metricMetas.dimensions에도 resource_name을 설정하면 ServiceWatch에서 지표 조회할 때 자원명을 함께 확인할 수 있습니다.배경색 변경
... "commonLabels": { "resource_name": "ResourceName" # User Console에서 확인 가능한 자원명 }, "metricMetas": [ { "metricName": "metric_name", "dimensions": [ [ "resource_id", "resource_name" # commonLabels에서 설정한 resource_name을 각 metric의 dimensions에 추가 ] ], "unit": "Bytes", "aggregationMethod": "SUM", "descriptionKo": "metric_name 설명", "descriptionEn": "metric_name description" }, ... ] ...... "commonLabels": { "resource_name": "ResourceName" # User Console에서 확인 가능한 자원명 }, "metricMetas": [ { "metricName": "metric_name", "dimensions": [ [ "resource_id", "resource_name" # commonLabels에서 설정한 resource_name을 각 metric의 dimensions에 추가 ] ], "unit": "Bytes", "aggregationMethod": "SUM", "descriptionKo": "metric_name 설명", "descriptionEn": "metric_name description" }, ... ] ...코드블록. metric.json - 자원명 설정
5. log.json 설정
ServiceWatch로 로그를 수집하기 위한 Log 설정 파일(log.json)을 정의합니다.
- 로그를 수집하려는 경우
log.json을 설정해야 합니다.구분 상세 설명 fileLog > include 수집할 로그 파일 위치 fileLog > operators 수집할 로그 메시지를 파싱하기 위해 정의 fileLog > operators > regex 로그 메시지 형식을 정규식으로 표현 fileLog > operators > timestamp ServiceWatch로 전송될 로그 메시지의 Time Stamp의 형식 logMetas > log_group_value ServiceWatch로 로그 전송을 위해 생성한 로그 그룹 이름 logMetas > log_stream_value ServiceWatch 로그 그룹내 로그 스트림 이름 표. log.json 설정 파일 항목배경색 변경{ "fileLog": { "include": [ "/var/log/syslog", # ServiceWatch로 수집할 로그 파일 "/var/log/auth.log" ], "operators": { "regex": "^(?P<timestamp>\\S+)\\s+(?P<hostname>\\S+)\\s+(?P<process>[^:]+):\\s+(?P<message>.*)$", # 로그 파일 형식을 정규식으로 표현 "timestamp": { # 로그 메시지의 Time Stamp 형식 설정 "layout_type": "gotime", "layout": "2006-01-02T15:04:05.000000Z07:00" } } }, "logMetas": { "log_group_value": "custom-log-group", # 사전에 생성한 ServiceWatch의 로그 그룹명 "log_stream_value": "custom-log-stream" # 사전에 생성한 ServiceWatch 로그 그룹 내의 로그 스트림명 } }{ "fileLog": { "include": [ "/var/log/syslog", # ServiceWatch로 수집할 로그 파일 "/var/log/auth.log" ], "operators": { "regex": "^(?P<timestamp>\\S+)\\s+(?P<hostname>\\S+)\\s+(?P<process>[^:]+):\\s+(?P<message>.*)$", # 로그 파일 형식을 정규식으로 표현 "timestamp": { # 로그 메시지의 Time Stamp 형식 설정 "layout_type": "gotime", "layout": "2006-01-02T15:04:05.000000Z07:00" } } }, "logMetas": { "log_group_value": "custom-log-group", # 사전에 생성한 ServiceWatch의 로그 그룹명 "log_stream_value": "custom-log-stream" # 사전에 생성한 ServiceWatch 로그 그룹 내의 로그 스트림명 } }코드블록. log.json 설정 예시
ServiceWatch Agent를 통해 서버의 로그 파일을 ServiceWatch에 연계하기 위해서는 로그 그룹과 로그 그룹 내 로그 스트림을 먼저 생성해야 합니다.
- 로그 그룹 생성 및 로그 스트림 생성에 대한 자세한 내용은 로그를 참고하세요.
ServiceWatch를 위한 Open Telemetry Collector 실행
| 실행 옵션 | 상세 설명 |
|---|---|
-action | 액션 설정 (run 또는 stop) |
-dir | agent.json, metric.json, log.json 과 같은 ServiceWatch Agent 설정 파일 위치 |
-collector | Open Telemetry Collector 실행파일 위치 |
ServiceWatch Agent 실행 (for Linux)
agent.json, metric.json, log.json 파일이 현재위치/os-metrics-min-examples에 있고, otelcontribcol_linux_amd64 파일이 현재위치에 있다고 가정했을 때 아래와 같이 실행합니다.ServiceWatch Agent를 실행합니다.
agent.json,metric.json,log.json파일 위치와servicewatch-agent-manager-linux-amd64,otelcontribcol_linux_amd64파일의 위치를 확인하여 ServiceWatch Agent를 시작합니다.- 실행 명령어는 수집 대상과 관계없이 동일하며,
-dir에 지정한 디렉터리의 설정 파일 구성에 따라 수집 대상이 결정됩니다.수집 대상 설정 파일 디렉터리 구성 지표와 로그 모두 수집 agent.json,metric.json,log.json지표만 수집 agent.json,metric.jsonlog.json을 다른 파일명으로 변경하거나 다른 디렉터리로 이동
로그만 수집 agent.json,log.jsonmetric.json을 다른 파일명으로 변경하거나 다른 디렉터리로 이동
표. 설정 파일 구성에 따른 수집 대상배경색 변경./servicewatch-agent-manager-linux-amd64 -action run -dir ./os-metrics-min-examples -collector ./otelcontribcol_linux_amd64./servicewatch-agent-manager-linux-amd64 -action run -dir ./os-metrics-min-examples -collector ./otelcontribcol_linux_amd64코드블록. ServiceWatch Agent 시작
ServiceWatch Agent를 중지합니다.
배경색 변경./servicewatch-agent-manager-linux-amd64 -action stop -dir ./os-metrics-min-examples./servicewatch-agent-manager-linux-amd64 -action stop -dir ./os-metrics-min-examples코드블록. ServiceWatch Agent 중지
ServiceWatch Agent 실행 (for Windows)
ServiceWatch Agent를 실행합니다.
- 수집 대상은
-dir에 지정한 디렉터리의 설정 파일 구성에 따라 결정됩니다. 자세한 내용은 설정 파일 구성에 따른 수집 대상을 참고하세요.배경색 변경servicewatch-agent-manager-windows-amd64.exe -action run -dir ./os-metrics-min-examples -collector otelcontribcol_windows_amd64.exeservicewatch-agent-manager-windows-amd64.exe -action run -dir ./os-metrics-min-examples -collector otelcontribcol_windows_amd64.exe코드블록. ServiceWatch Agent 시작
- 수집 대상은
ServiceWatch Agent를 중지합니다.
배경색 변경servicewatch-agent-manager-windows-amd64.exe -action stop -dir ./os-metrics-min-examplesservicewatch-agent-manager-windows-amd64.exe -action stop -dir ./os-metrics-min-examples코드블록. ServiceWatch Agent 중지