Google Artifact Registry에서 도커 풀 수를 추적할 수 있습니까? (Is it possible track the number of docker pulls in Google Artifact Registry?)


문제 설명

Google Artifact Registry에서 도커 풀 수를 추적할 수 있습니까? (Is it possible track the number of docker pulls in Google Artifact Registry?)

내 GCP 프로젝트의 Google Artifact 레지스트리 저장소에서 Docker 이미지가 다운로드된 횟수를 측정하고 싶습니다.

가능한가요?


참조 솔루션

방법 1:

Interesting question.

I think this would be useful too.

I think there aren't any Monitoring metrics (no artifactregistry resource type is listed nor metrics are listed)

However, you can use Artifact Registry audit logs and you'll need to explicitly enable Data Access logs see e.g. Docker‑GetManifest.

enter image description here

NOTE I'm unsure whether this can be achieved from gcloud.

Monitoring Developer tools, I learned that Audit Logs are configured in Project Policies using AuditConfig's. I still don't know whether this functionality is available through gcloud (anyone?) but evidently, you can effect these changes directly using API calls e.g. projects.setIamPolicy:

gcloud projects get‑iam‑policy ${PROJECT}
auditConfigs:
‑ auditLogConfigs:
  ‑ logType: DATA_READ
  ‑ logType: DATA_WRITE
  service: artifactregistry.googleapis.com
bindings:
‑ members:
  ‑ user:me
  role: roles/owner
etag: BwXanQS_YWg=

Then, pull something from the repo and query the logs:

PROJECT=[[YOUR‑PROJECT]]
REGION=[[YOUR‑REGION]]
REPO=[[YOUR‑REPO]]

FILTER="
logName=\"projects/${PROJECT}/logs/cloudaudit.googleapis.com%2Fdata_access\"
protoPayload.methodName=\"Docker‑GetManifest\"
"

gcloud logging read "${FILTER}" \
‑‑project=${PROJECT} \
‑‑format="value(timestamp,protoPayload.methodName)"

Yields:

2022‑03‑20T01:57:16.537400441Z  Docker‑GetManifest

You ought to be able to create a logs‑based metrics for these too.

(by Natan YellinDazWilkin)

참조 문서

  1. Is it possible track the number of docker pulls in Google Artifact Registry? (CC BY‑SA 2.5/3.0/4.0)

#google-cloud-platform #gcloud #google-artifact-registry






관련 질문

Google API용 Android 키 사용 제한 (Restricting usage for an Android key for a Google API)

GCS 버킷에서 큰 폴더를 삭제하는 빠른 방법 (Fast way to delete big folder on GCS bucket)

Terraform 코드와 충돌하는 "소유자"에 의한 GCP 콘솔/클라우드 셸 변경을 어떻게 방지할 수 있습니까? (How can you prevent GCP console/cloud shell changes by "Owners" conflicting with the terraform code?)

서비스 계정으로 인증할 때 project_id를 명시적으로 설정하는 것을 피할 수 있습니까? (Is it possible to avoid setting project_id explicitly when authing with service account?)

Wordpress가 새 PHP 버전을 감지하지 못합니다 (Wordpress doesn't detect new php version)

카운터를 사용하여 테이블에 삽입된 레코드 수를 계산하고 python 스크립트를 사용하여 실행되는 각 작업에서 삽입된 레코드 수를 인쇄하는 방법 (How to count number of inserted records in table using counter and print the count of inserted record in each job run using python script)

Google Cloud 자연어 가져오기 오류 (Google Cloud Natural Language Import Error)

gcloud는 전체 컨테이너를 다시 빌드하지만 Dockerfile은 동일하고 스크립트만 변경됨 (gcloud rebuilds complete container but Dockerfile is the same, only the script has changed)

GCP를 통한 Kubernetes 대시보드 (Kubernetes dashboard via GCP)

Firebase 실시간 데이터베이스 키 없이 하위 레코드를 얻는 방법 (Firebase realtime database how to get a child record without the key)

Google Cloud Function / MongoDB VM 인스턴스 통신 (Google Cloud Function / MongoDB VM instance communication)

Google Artifact Registry에서 도커 풀 수를 추적할 수 있습니까? (Is it possible track the number of docker pulls in Google Artifact Registry?)







코멘트