Audit Events API

Tier: Premium, Ultimate Offering: GitLab.com, 자체 호스팅, GitLab Dedicated

- GitLab 12.4에 도입
- GitLab 15.9에서 응답 본문에 작성자 이메일 추가

인스턴스 감사 이벤트

Tier: Premium, Ultimate Offering: 자체 호스팅, GitLab Dedicated

이 API를 사용하여 인스턴스 감사 이벤트를 검색합니다.

API를 사용하여 감사 이벤트를 검색하려면 관리자로 인증해야 합니다.

모든 인스턴스 감사 이벤트 검색

- GitLab 15.11에 키셋 페이지네이션 지원 도입
- 인스턴스 감사 이벤트를 위한 엔터티 유형 Gitlab::Audit::InstanceScope GitLab 16.2에서 도입

GET /audit_events
속성 유형 필수 설명
created_after 문자열 아니오 주어진 시간 이후에 생성된 감사 이벤트를 반환합니다. 형식: ISO 8601 (YYYY-MM-DDTHH:MM:SSZ)
created_before 문자열 아니오 주어진 시간 이전에 생성된 감사 이벤트를 반환합니다. 형식: ISO 8601 (YYYY-MM-DDTHH:MM:SSZ)
entity_type 문자열 아니오 주어진 엔터티 유형에 대한 감사 이벤트를 반환합니다. 유효한 값: User, Group, Project, 또는 Gitlab::Audit::InstanceScope.
entity_id 정수 아니오 주어진 엔터티 ID에 대한 감사 이벤트를 반환합니다. entity_type 속성이 존재해야 합니다.

이 엔드포인트는 오프셋 및 키셋 기반 페이지네이션을 지원합니다. 결과의 연이은 페이지를 요청할 때 키셋 기반 페이지네이션을 사용해야 합니다.

자세한 내용은 페이지네이션을 참조하세요.

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/audit_events"

예시 응답:

[
  {
    "id": 1,
    "author_id": 1,
    "entity_id": 6,
    "entity_type": "Project",
    "details": {
      "custom_message": "프로젝트가 보관됨",
      "author_name": "관리자",
      "author_email": "admin@example.com",
      "target_id": "flightjs/flight",
      "target_type": "프로젝트",
      "target_details": "flightjs/flight",
      "ip_address": "127.0.0.1",
      "entity_path": "flightjs/flight"
    },
    "created_at": "2019-08-30T07:00:41.885Z"
  },
  {
    "id": 2,
    "author_id": 1,
    "entity_id": 60,
    "entity_type": "그룹",
    "details": {
      "add": "그룹",
      "author_name": "관리자",
      "author_email": "admin@example.com",
      "target_id": "flightjs",
      "target_type": "그룹",
      "target_details": "flightjs",
      "ip_address": "127.0.0.1",
      "entity_path": "flightjs"
    },
    "created_at": "2019-08-27T18:36:44.162Z"
  },
  {
    "id": 3,
    "author_id": 51,
    "entity_id": 51,
    "entity_type": "사용자",
    "details": {
      "change": "이메일 주소",
      "from": "hello@flightjs.com",
      "to": "maintainer@flightjs.com",
      "author_name": "안드레아스",
      "author_email": "admin@example.com",
      "target_id": 51,
      "target_type": "사용자",
      "target_details": "안드레아스",
      "ip_address": null,
      "entity_path": "안드레아스"
    },
    "created_at": "2019-08-22T16:34:25.639Z"
  },
  {
    "id": 4,
    "author_id": 43,
    "entity_id": 1,
    "entity_type": "Gitlab::Audit::InstanceScope",
    "details": {
      "author_name": "관리자",
      "author_class": "사용자",
      "target_id": 32,
      "target_type": "AuditEvents::Streaming::InstanceHeader",
      "target_details": "알 수 없음",
      "custom_message": "키 X-arg로 사용자 정의 HTTP 헤더 생성됨",
      "ip_address": "127.0.0.1",
      "entity_path": "GitLab 인스턴스"
    },
    "created_at": "2023-08-01T11:29:44.764Z",
    "target_type": "AuditEvents::Streaming::InstanceHeader",
    "target_id": 32,
    "event_type": "audit_events_streaming_instance_headers_create"
  }
]

단일 인스턴스 감사 이벤트 검색

GET /audit_events/:id
속성 유형 필수 설명
id 정수 감사 이벤트의 ID
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/audit_events/1"

예시 응답:

{
  "id": 1,
  "author_id": 1,
  "entity_id": 6,
  "entity_type": "프로젝트",
  "details": {
    "custom_message": "프로젝트가 보관됨",
    "author_name": "관리자",
    "author_email": "admin@example.com",
    "target_id": "flightjs/flight",
    "target_type": "프로젝트",
    "target_details": "flightjs/flight",
    "ip_address": "127.0.0.1",
    "entity_path": "flightjs/flight"
  },
  "created_at": "2019-08-30T07:00:41.885Z"
}

그룹 감사 이벤트

  • GitLab 15.2에서 도입된 키셋 페이지네이션을 지원합니다.

그룹 감사 이벤트를 검색하는 데에 이 API를 사용하세요.

소유자 역할을 가진 사용자는 모든 사용자의 그룹 감사 이벤트를 검색할 수 있습니다. 개발자 또는 관리자 역할을 가진 사용자는 개별 작업에 기반한 그룹 감사 이벤트에만 제한됩니다.

이 엔드포인트는 오프셋 기반 및 키셋 기반 페이지네이션을 지원합니다. 연이어 나오는 결과 페이지를 요청할 때 키셋 기반 페이지네이션을 권장합니다.

모든 그룹 감사 이벤트 검색

  • GitLab 15.2에서 도입된 키셋 페이지네이션을 지원합니다.
GET /groups/:id/audit_events
속성 유형 필수 설명
id integer/string 그룹의 ID 또는 URL 인코딩된 경로
created_after string 아니요 주어진 시간 이후에 생성된 그룹 감사 이벤트를 반환합니다. 형식: ISO 8601 (YYYY-MM-DDTHH:MM:SSZ)
created_before string 아니요 주어진 시간 이전에 생성된 그룹 감사 이벤트를 반환합니다. 형식: ISO 8601 (YYYY-MM-DDTHH:MM:SSZ)

기본적으로 GET 요청은 API 결과를 페이지별로 20개씩 반환합니다.

자세한 내용은 페이지네이션에서 확인하십시오.

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/groups/60/audit_events"

예시 응답:

[
  {
    "id": 2,
    "author_id": 1,
    "entity_id": 60,
    "entity_type": "Group",
    "details": {
      "custom_message": "Group marked for deletion",
      "author_name": "Administrator",
      "author_email": "admin@example.com",
      "target_id": "flightjs",
      "target_type": "Group",
      "target_details": "flightjs",
      "ip_address": "127.0.0.1",
      "entity_path": "flightjs"
    },
    "created_at": "2019-08-28T19:36:44.162Z"
  },
  {
    "id": 1,
    "author_id": 1,
    "entity_id": 60,
    "entity_type": "Group",
    "details": {
      "add": "group",
      "author_name": "Administrator",
      "author_email": "admin@example.com",
      "target_id": "flightjs",
      "target_type": "Group",
      "target_details": "flightjs",
      "ip_address": "127.0.0.1",
      "entity_path": "flightjs"
    },
    "created_at": "2019-08-27T18:36:44.162Z"
  }
]

특정 그룹 감사 이벤트 검색

그룹 소유자 및 관리자에게만 제공됩니다.

GET /groups/:id/audit_events/:audit_event_id
속성 유형 필수 설명
id integer/string 그룹의 ID 또는 URL 인코딩된 경로
audit_event_id integer 감사 이벤트의 ID
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/groups/60/audit_events/2"

예시 응답:

{
  "id": 2,
  "author_id": 1,
  "entity_id": 60,
  "entity_type": "Group",
  "details": {
    "custom_message": "Group marked for deletion",
    "author_name": "Administrator",
    "author_email": "admin@example.com",
    "target_id": "flightjs",
    "target_type": "Group",
    "target_details": "flightjs",
    "ip_address": "127.0.0.1",
    "entity_path": "flightjs"
  },
  "created_at": "2019-08-28T19:36:44.162Z"
}

프로젝트 감사 이벤트

  • GitLab 13.1에서 도입된 기능입니다.

프로젝트 감사 이벤트를 검색하는 데에 이 API를 사용하세요.

관리자 역할 또는 그 이상의 역할을 가진 사용자는 모든 사용자의 프로젝트 감사 이벤트를 검색할 수 있습니다. 개발자 역할을 가진 사용자는 개별 작업에 기반한 프로젝트 감사 이벤트에만 제한됩니다.

모든 프로젝트 감사 이벤트 검색

  • GitLab 15.10에서 도입된 키셋 페이지네이션을 지원합니다.
GET /projects/:id/audit_events
속성 유형 필수 설명
id integer/string 프로젝트의 ID 또는 URL 인코딩된 경로
created_after string 아니요 주어진 시간 이후에 생성된 프로젝트 감사 이벤트를 반환합니다. 형식: ISO 8601 (YYYY-MM-DDTHH:MM:SSZ)
created_before string 아니요 주어진 시간 이전에 생성된 프로젝트 감사 이벤트를 반환합니다. 형식: ISO 8601 (YYYY-MM-DDTHH:MM:SSZ)

기본적으로 GET 요청은 API 결과를 페이지별로 20개씩 반환합니다. 연이어 나오는 결과 페이지를 요청할 때 키셋 페이지네이션을 사용해야 합니다.

자세한 내용은 페이지네이션에서 확인하십시오.

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/projects/7/audit_events"

예시 응답:

[
  {
    "id": 5,
    "author_id": 1,
    "entity_id": 7,
    "entity_type": "Project",
    "details": {
        "change": "prevent merge request approval from committers",
        "from": "",
        "to": "true",
        "author_name": "Administrator",
        "author_email": "admin@example.com",
        "target_id": 7,
        "target_type": "Project",
        "target_details": "twitter/typeahead-js",
        "ip_address": "127.0.0.1",
        "entity_path": "twitter/typeahead-js"
    },
    "created_at": "2020-05-26T22:55:04.230Z"
  },
  {
      "id": 4,
      "author_id": 1,
      "entity_id": 7,
      "entity_type": "Project",
      "details": {
          "change": "prevent merge request approval from authors",
          "from": "false",
          "to": "true",
          "author_name": "Administrator",
          "author_email": "admin@example.com",
          "target_id": 7,
          "target_type": "Project",
          "target_details": "twitter/typeahead-js",
          "ip_address": "127.0.0.1",
          "entity_path": "twitter/typeahead-js"
      },
      "created_at": "2020-05-26T22:55:04.218Z"
  }
]

특정 프로젝트 감사 이벤트 검색

프로젝트의 유지자(Maintainer) 역할을 적어도 가진 사용자에게만 사용할 수 있습니다.

GET /projects/:id/audit_events/:audit_event_id
속성 유형 필수 설명
id 정수/문자열 프로젝트의 ID 또는 URL 인코딩된 경로
audit_event_id 정수 감사 이벤트의 ID
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/projects/7/audit_events/5"

예시 응답:

{
  "id": 5,
  "author_id": 1,
  "entity_id": 7,
  "entity_type": "Project",
  "details": {
      "change": "prevent merge request approval from committers",
      "from": "",
      "to": "true",
      "author_name": "Administrator",
      "author_email": "admin@example.com",
      "target_id": 7,
      "target_type": "Project",
      "target_details": "twitter/typeahead-js",
      "ip_address": "127.0.0.1",
      "entity_path": "twitter/typeahead-js"
  },
  "created_at": "2020-05-26T22:55:04.230Z"
}