> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/api-sdk-cli/ko/sdks/automation-observability-and-audit.md).

# 자동화 모니터링과 감사

Python SDK 자동화가 Unitlab에서 변경한 내용을 추적할 수 있도록 로그에 남길 항목, 절대 남기면 안 되는 비밀·고객 데이터, X-Request-ID와 감사 로그 연계 방법을 설명합니다.

## 로그에 남길 항목 <a href="#what-to-log" id="what-to-log"></a>

| 필드           | 예시                                     |
| ------------ | -------------------------------------- |
| SDK와 작업 버전   | `unitlab 3.2.0`, `nightly-import 1.4`  |
| 키 이름         | `CI upload script` (키 자체는 절대 기록하지 마세요) |
| 작업 종류와 실행 ID | `upload`, 작업의 실행 ID                    |
| 리소스 ID       | 프로젝트, Batch Queue, 데이터셋과 버전, 릴리스, 작업   |
| 결과           | 개수, 최종 상태, 소요 시간                       |
| 오류           | 예외 클래스, `code`, 메시지                    |

```python
import logging
import unitlab

log = logging.getLogger("nightly-import")
batch = project.upload("./cell-04")
status = batch.wait()
log.info(
    "upload done sdk=%s project=%s batch_queue=%s total=%d failed=%d",
    unitlab.__version__,
    project.id, batch.batch_queue_id, status.total, status.failed + len(batch.failed),
)
```

## 절대 로그에 남기지 말 것 <a href="#never-log" id="never-log"></a>

* API 키와 웹훅 서명 비밀 키
* 서명된 미디어 링크(`source_url`, `thumbnail_url`, 다운로드 링크)
* 미디어, 어노테이션 문서, 웹훅 본문 전체

## 내 로그와 Unitlab 로그 대조 <a href="#match-your-logs-to-unitlabs" id="match-your-logs-to-unitlabs"></a>

모든 API 응답에는 `X-Request-ID` 헤더가 있습니다. 워크스페이스 [감사 로그](https://docs.unitlab.ai/documentation/ko/security/audit-log)는 프로젝트 생성, 데이터 업로드, 데이터셋 버전 게시, 온톨로지 변경, 릴리스 생성·다운로드처럼 API 키로 수행한 작업을 기록합니다. 키가 수행자로 표시되며, 요청 ID로 필터링할 수 있습니다.

작업마다 작업 이름을 붙인 키를 하나씩 사용하면 감사 로그에서 작업을 구분할 수 있습니다.

## 관련 문서 <a href="#related" id="related"></a>

[인증과 API 키](https://docs.unitlab.ai/api-sdk-cli/ko/get-started/authentication-and-api-keys.md) · [예외, 타임아웃, 재시도](https://docs.unitlab.ai/api-sdk-cli/ko/sdks/exceptions-timeouts-and-retries.md)
