Menlo Security Isolation Platform(MSIP) 로그 수집
이 가이드에서는 Google Cloud Storage를 사용하여 Menlo Security Isolation Platform(MSIP) 로그를 Google SecOps에 수집하는 방법을 설명합니다.
Menlo Security의 격리 중심 접근 방식은 사용자의 기기와 엔드포인트에서 떨어진 격리된 일회용 가상 컨테이너(DVC) 간에 웹 브라우징과 문서 검색을 분할합니다. 모든 위험한 코드는 격리된 DVC에서 실행되며 엔드포인트에 도달하지 않습니다. 안전한 표시 데이터만 사용자 브라우저로 전송됩니다. 이 플랫폼은 웹 액세스, 감사 이벤트, 이메일 보안, DLP 위반, SMTP 활동에 대한 포괄적인 로깅을 제공합니다.
시작하기 전에
다음 기본 요건을 충족하는지 확인합니다.
- Google SecOps 인스턴스
- Menlo Security 관리 포털에 대한 권한 있는 액세스
- Menlo Security에서 API 토큰을 만들 수 있는 권한
- Cloud Storage, Cloud Run, Pub/Sub, Cloud Scheduler API가 사용 설정된 GCP 프로젝트
Menlo Security API 액세스 구성하기
Cloud Run 함수가 로그를 검색할 수 있도록 하려면 Log Export API 권한이 있는 API 토큰을 만들어야 합니다.
API 토큰 만들기
https://admin.menlosecurity.com에서 Menlo Security 관리 포털에 로그인합니다.- 설정 > 인증 > API 토큰으로 이동합니다.
- 토큰 만들기를 클릭합니다.
- 토큰 이름 필드에 설명이 포함된 이름(예:
Chronicle GCS Integration)을 입력합니다. - 권한 섹션에서 Log Export API를 선택합니다.
- 만들기 또는 저장을 클릭합니다.
- 생성된 API 토큰을 복사하여 안전하게 저장합니다.
중요: API 토큰은 한 번만 표시됩니다. 생성 직후 안전한 위치에 저장합니다.
필수 API 권한
API 토큰에는 다음 권한이 필요합니다.
권한/범위 액세스 수준 목적 Log Export API 읽기 Menlo Security API에서 로그 가져오기
Google Cloud Storage 버킷 만들기
- Google Cloud 콘솔로 이동하세요.
- 프로젝트를 선택하거나 새 프로젝트를 만듭니다.
- 탐색 메뉴에서 Cloud Storage > 버킷으로 이동합니다.
- 버킷 만들기를 클릭합니다.
다음 구성 세부정보를 제공합니다.
설정 값 버킷 이름 지정 전역적으로 고유한 이름(예: menlo-security-logs)을 입력합니다.위치 유형 필요에 따라 선택(리전, 이중 리전, 멀티 리전) 위치 위치를 선택합니다(예: us-central1).스토리지 클래스 표준(자주 액세스하는 로그에 권장) 액세스 제어 균일(권장) 보호 도구 선택사항: 객체 버전 관리 또는 보관 정책 사용 설정 만들기를 클릭합니다.
Cloud Run Functions의 서비스 계정 만들기
서비스 계정 만들기
- GCP Console에서 IAM 및 관리자 > 서비스 계정으로 이동합니다.
- 서비스 계정 만들기를 클릭합니다.
- 다음 구성 세부정보를 제공합니다.
- 서비스 계정 이름:
menlo-logs-collector-sa을 입력합니다. - 서비스 계정 설명:
Service account for Cloud Run function to collect Menlo Security logs을 입력합니다.
- 서비스 계정 이름:
- 만들고 계속하기를 클릭합니다.
- 이 서비스 계정에 프로젝트에 대한 액세스 권한 부여 섹션에서 다음 역할을 추가합니다.
- 역할 선택을 클릭합니다.
- 스토리지 객체 관리자를 검색하여 선택합니다.
- + 다른 역할 추가를 클릭합니다.
- Cloud Run 호출자를 검색하여 선택합니다.
- + 다른 역할 추가를 클릭합니다.
- Cloud Functions 호출자를 검색하여 선택합니다.
- 계속을 클릭합니다.
- 완료를 클릭합니다.
GCS 버킷에 IAM 권한 부여
- Cloud Storage > 버킷으로 이동합니다.
- 버킷 이름(
menlo-security-logs)을 클릭합니다. - 권한 탭으로 이동합니다.
- 액세스 권한 부여를 클릭합니다.
- 다음 구성 세부정보를 제공합니다.
- 주 구성원 추가: 서비스 계정 이메일(
menlo-logs-collector-sa@PROJECT_ID.iam.gserviceaccount.com)을 입력합니다. - 역할 할당: 스토리지 객체 관리자를 선택합니다.
- 주 구성원 추가: 서비스 계정 이메일(
- 저장을 클릭합니다.
Pub/Sub 주제 만들기
- GCP Console에서 Pub/Sub > 주제로 이동합니다.
- 주제 만들기를 클릭합니다.
- 다음 구성 세부정보를 제공합니다.
- 주제 ID:
menlo-logs-trigger를 입력합니다. - 다른 설정은 기본값으로 둡니다.
- 주제 ID:
- 만들기를 클릭합니다.
로그를 수집하는 Cloud Run 함수 만들기
- GCP Console에서 Cloud Run으로 이동합니다.
- 서비스 만들기를 클릭합니다.
- 함수(인라인 편집기를 사용하여 함수 만들기)를 선택합니다.
구성 섹션에서 다음 구성 세부정보를 제공합니다.
설정 값 서비스 이름 menlo-logs-collector리전 GCS 버킷과 일치하는 리전을 선택합니다(예: us-central1).런타임 Python 3.12 이상을 선택합니다. 트리거(선택사항) 섹션에서 다음을 수행합니다.
- + 트리거 추가를 클릭합니다.
- Cloud Pub/Sub를 선택합니다.
- Cloud Pub/Sub 주제 선택에서
menlo-logs-trigger를 선택합니다. - 저장을 클릭합니다.
인증 섹션에서 다음을 구성합니다.
- 인증 필요를 선택합니다.
- Identity and Access Management(IAM)를 확인합니다.
아래로 스크롤하고 컨테이너, 네트워킹, 보안을 펼칩니다.
보안 탭으로 이동합니다.
- 서비스 계정:
menlo-logs-collector-sa를 선택합니다.
- 서비스 계정:
컨테이너 탭으로 이동합니다.
- 변수 및 보안 비밀을 클릭합니다.
- 각 환경 변수에 대해 + 변수 추가를 클릭합니다.
변수 이름 예시 값 설명 GCS_BUCKETmenlo-security-logsGCS 버킷 이름 GCS_PREFIXmenlo-logs로그 파일의 프리픽스 STATE_KEYmenlo-logs/state.json상태 파일 경로 MENLO_API_TOKENyour-menlo-api-tokenMenlo Security API 토큰 MENLO_API_HOSTlogs.menlosecurity.comMenlo Security API 호스트 MENLO_LOG_TYPESweb,audit,email,dlp쉼표로 구분된 로그 유형 LOOKBACK_HOURS1초기 대상 기간 변수 및 보안 비밀 섹션에서 요청까지 아래로 스크롤합니다.
- 요청 제한 시간:
600초(10분)를 입력합니다.
- 요청 제한 시간:
설정 탭으로 이동합니다.
- 리소스 섹션에서 다음을 수행합니다.
- 메모리: 512MiB 이상을 선택합니다.
- CPU: 1 선택
- 리소스 섹션에서 다음을 수행합니다.
버전 확장 섹션에서 다음을 수행합니다.
- 최소 인스턴스 수:
0를 입력합니다. - 최대 인스턴스 수:
100을 입력합니다.
- 최소 인스턴스 수:
만들기를 클릭합니다.
서비스가 생성될 때까지 기다립니다(1~2분).
서비스가 생성되면 인라인 코드 편집기가 자동으로 열립니다.
함수 코드 추가
- 진입점 필드에 main을 입력하세요.
인라인 코드 편집기에서 다음 두 파일을 만듭니다.
- main.py:
import functions_framework from google.cloud import storage import os import json import urllib3 import time import uuid from datetime import datetime, timezone, timedelta http = urllib3.PoolManager( timeout=urllib3.Timeout(connect=5.0, read=60.0), retries=False, ) storage_client = storage.Client() GCS_BUCKET = os.environ.get('GCS_BUCKET') GCS_PREFIX = os.environ.get('GCS_PREFIX', 'menlo-logs') STATE_KEY = os.environ.get('STATE_KEY', 'menlo-logs/state.json') API_TOKEN = os.environ.get('MENLO_API_TOKEN') API_HOST = os.environ.get('MENLO_API_HOST', 'logs.menlosecurity.com') LOG_TYPES = os.environ.get('MENLO_LOG_TYPES', 'web').split(',') LOOKBACK_HOURS = int(os.environ.get('LOOKBACK_HOURS', '1')) @functions_framework.cloud_event def main(cloud_event): if not all([GCS_BUCKET, API_TOKEN, API_HOST]): print('Error: Missing required environment variables') return try: bucket = storage_client.bucket(GCS_BUCKET) state = load_state(bucket) now = datetime.now(timezone.utc).replace(microsecond=0) if isinstance(state, dict) and state.get('last_event_time'): try: last_val = state['last_event_time'] if last_val.endswith('Z'): last_val = last_val[:-1] + '+00:00' last_time = datetime.fromisoformat(last_val) last_time = last_time - timedelta(minutes=2) except Exception as e: print(f"Warning: Could not parse last_event_time: {e}") last_time = now - timedelta(hours=LOOKBACK_HOURS) else: last_time = now - timedelta(hours=LOOKBACK_HOURS) print(f"Fetching logs from {last_time.isoformat()} to {now.isoformat()}") total = 0 newest_time = None for log_type in LOG_TYPES: log_type = log_type.strip() print(f"Fetching {log_type} logs...") events = fetch_logs(log_type, API_TOKEN, API_HOST, last_time, now) if events: object_key = f"{GCS_PREFIX}/{now:%Y/%m/%d}/menlo-{log_type}-{uuid.uuid4()}.ndjson" blob = bucket.blob(object_key) ndjson = '\n'.join( [json.dumps(ev, ensure_ascii=False) for ev in events] ) + '\n' blob.upload_from_string(ndjson, content_type='application/x-ndjson') print(f"Uploaded {len(events)} {log_type} events to gs://{GCS_BUCKET}/{object_key}") total += len(events) for ev in events: ev_time = ev.get('timestamp') or ev.get('time') or ev.get('created_at') if ev_time and (newest_time is None or str(ev_time) > str(newest_time)): newest_time = str(ev_time) else: print(f"No {log_type} events found") save_state(bucket, newest_time if newest_time else now.isoformat()) print(f"Successfully processed {total} total events") except Exception as e: print(f'Error processing logs: {str(e)}') raise def fetch_logs(log_type, token, api_host, start, end): url = f"https://{api_host}/api/v1/logs/{log_type}" headers = { 'Authorization': f'Token {token}', 'Accept': 'application/json', } params = { 'start': start.strftime('%Y-%m-%dT%H:%M:%SZ'), 'end': end.strftime('%Y-%m-%dT%H:%M:%SZ'), } query = '&'.join(f'{k}={v}' for k, v in params.items()) full_url = f'{url}?{query}' all_events = [] backoff = 1.0 while full_url: response = http.request('GET', full_url, headers=headers) if response.status == 429: retry_after = int(response.headers.get('Retry-After', str(int(backoff)))) print(f"Rate limited. Waiting {retry_after}s...") time.sleep(retry_after) backoff = min(backoff * 2, 60.0) continue if response.status != 200: print(f"API error {response.status}: {response.data.decode('utf-8')}") break backoff = 1.0 data = json.loads(response.data.decode('utf-8')) events = data if isinstance(data, list) else data.get('events', data.get('data', [])) all_events.extend(events) full_url = data.get('next') if isinstance(data, dict) else None print(f"Total {log_type} events fetched: {len(all_events)}") return all_events def load_state(bucket): try: blob = bucket.blob(STATE_KEY) if blob.exists(): return json.loads(blob.download_as_text()) except Exception as e: print(f"Warning: Could not load state: {e}") return {} def save_state(bucket, last_event_time_iso): try: state = { 'last_event_time': last_event_time_iso, 'last_run': datetime.now(timezone.utc).isoformat() } blob = bucket.blob(STATE_KEY) blob.upload_from_string( json.dumps(state, indent=2), content_type='application/json' ) print(f"Saved state: last_event_time={last_event_time_iso}") except Exception as e: print(f"Warning: Could not save state: {e}")- requirements.txt:
functions-framework==3.* google-cloud-storage==2.* urllib3>=2.0.0배포를 클릭하여 함수를 저장하고 배포합니다.
배포가 완료될 때까지 기다립니다(2~3분).
Cloud Scheduler 작업 만들기
- GCP Console에서 Cloud Scheduler로 이동합니다.
- 작업 만들기를 클릭합니다.
다음 구성 세부정보를 제공합니다.
설정 값 이름 menlo-logs-collector-hourly리전 Cloud Run 함수와 동일한 리전 선택 주파수 0 * * * *(매시간 정각)시간대 시간대 선택(UTC 권장) 타겟 유형 Pub/Sub 주제 menlo-logs-trigger선택메일 본문 {}(빈 JSON 객체)만들기를 클릭합니다.
통합 테스트
- Cloud Scheduler 콘솔에서 작업(
menlo-logs-collector-hourly)을 찾습니다. - 강제 실행을 클릭하여 작업을 수동으로 트리거합니다.
- 몇 초 동안 기다립니다.
- Cloud Run > 서비스로 이동합니다.
menlo-logs-collector를 클릭합니다.- 로그 탭을 클릭합니다.
함수가 실행되었는지 확인합니다. 다음 항목을 찾습니다.
Fetching logs from YYYY-MM-DDTHH:MM:SS+00:00 to YYYY-MM-DDTHH:MM:SS+00:00 Fetching web logs... Total web events fetched: X Uploaded X web events to gs://menlo-security-logs/menlo-logs/YYYY/MM/DD/menlo-web-UUID.ndjson Successfully processed X total eventsCloud Storage > 버킷으로 이동합니다.
menlo-security-logs를 클릭합니다.menlo-logs/폴더로 이동합니다.현재 날짜로 새
.ndjson파일이 생성되었는지 확인합니다.
로그에 오류가 표시되는 경우:
- HTTP 401:
MENLO_API_TOKEN환경 변수가 올바른지 확인합니다. - HTTP 403: API 토큰에 로그 내보내기 API 권한이 있는지 확인합니다.
- HTTP 429: 비율 제한 — 함수가 백오프를 사용하여 자동으로 재시도합니다.
- 환경 변수 누락: Cloud Run 함수 구성에 필요한 모든 변수가 설정되어 있는지 확인합니다.
Google SecOps 서비스 계정 가져오기
- 설정 > 데이터 관리 > 피드로 이동합니다. SIEM 전용 플랫폼을 사용하는 경우 설정 > 피드로 이동합니다.
- 새 피드 추가를 클릭합니다.
- 단일 피드 구성을 클릭합니다.
- 피드 이름 필드에 피드 이름을 입력합니다(예:
Menlo Security MSIP Logs). - 소스 유형으로 Google Cloud Storage V2를 선택합니다.
- 로그 유형으로 Menlo Security를 선택합니다.
서비스 계정 가져오기를 클릭합니다. 고유한 서비스 계정 이메일이 표시됩니다. 예를 들면 다음과 같습니다.
chronicle-12345678@chronicle-gcp-prod.iam.gserviceaccount.com다음 단계에서 사용할 수 있도록 이 이메일 주소를 복사합니다.
다음을 클릭합니다.
다음 입력 파라미터의 값을 지정합니다.
스토리지 버킷 URL: 프리픽스 경로가 있는 GCS 버킷 URI를 입력합니다.
gs://menlo-security-logs/menlo-logs/
소스 삭제 옵션: 환경설정에 따라 삭제 옵션을 선택합니다.
- 삭제 안함: 전송 후 파일을 삭제하지 않습니다(테스트에 권장).
- 전송된 파일 삭제: 전송이 완료된 후 파일을 삭제합니다.
전송된 파일 및 빈 디렉터리 삭제: 전송이 완료된 후 파일과 빈 디렉터리를 삭제합니다.
최대 파일 기간: 지난 며칠 동안 수정된 파일을 포함합니다(기본값은 180일).
애셋 네임스페이스: 애셋 네임스페이스
수집 라벨: 이 피드의 이벤트에 적용할 라벨입니다.
다음을 클릭합니다.
확정 화면에서 새 피드 구성을 검토한 다음 제출을 클릭합니다.
Google SecOps 서비스 계정에 IAM 권한 부여
- Cloud Storage > 버킷으로 이동합니다.
menlo-security-logs를 클릭합니다.- 권한 탭으로 이동합니다.
- 액세스 권한 부여를 클릭합니다.
- 다음 구성 세부정보를 제공합니다.
- 주 구성원 추가: Google SecOps 서비스 계정 이메일을 붙여넣습니다.
- 역할 할당: 스토리지 객체 뷰어를 선택합니다.
- 저장을 클릭합니다.
UDM 매핑 테이블
| 로그 필드 | UDM 매핑 | 로직 |
|---|---|---|
| customer_name | intermediary.hostname | customer_name이 IP가 아닌 경우 설정 |
| customer_name | intermediary.ip | IP인 경우 customer_name에서 추출되거나 xff_ip IP에서 추출됩니다. |
| xff_ip | intermediary.ip | |
| event_data.event_time | metadata.event_timestamp | grok 및 날짜 필터를 사용하여 파싱됨 |
| request_type | metadata.event_type | 이러한 필드를 기반으로 하는 조건부 로직 |
| has_principal | metadata.event_type | |
| has_top_url | metadata.event_type | |
| has_dest | metadata.event_type | |
| log_type | metadata.log_type | 값이 직접 복사됨 |
| event_data.name | metadata.product_event_type | 값이 직접 복사됨 |
| reqId | metadata.product_log_id | 값이 직접 복사됨 |
| event_data.version | metadata.product_version | 값이 직접 복사됨 |
| event_data.protocol | network.application_protocol | 사전 정의된 프로토콜 목록을 사용하여 매핑됨 |
| request_type | network.http.method | 값이 직접 복사됨 |
| 리퍼러 | network.http.referral_url | 값이 직접 복사됨 |
| response_code | network.http.response_code | 정수로 변환됨 |
| event_data.user-agent | network.http.user_agent | 값이 직접 복사됨 |
| full_session_id | network.session_id | 값이 직접 복사됨 |
| browser_and_version | principal.application | 값이 직접 복사됨 |
| event_data.x-client-ip | principal.asset.ip | event_data.x-client-ip의 값(비어 있지 않은 경우). 비어 있으면 src_ip |
| src_ip | principal.asset.ip | |
| groups | principal.group.product_object_id | 값이 직접 복사됨 |
| event_data.x-client-ip | principal.ip | event_data.x-client-ip의 값(비어 있지 않은 경우). 비어 있으면 src_ip |
| src_ip | principal.ip | |
| 리전 | principal.location.country_or_region | 비어 있지 않은 경우 region의 값, 그렇지 않으면 egress_country |
| egress_country | principal.location.country_or_region | |
| region_name | principal.location.name | 값이 직접 복사됨 |
| egress_ip | principal.nat_ip | 값이 직접 복사됨 |
| event_data.userid | principal.user.email_addresses | 이메일 정규식과 일치하는 경우 병합됨 |
| event_data.userid | principal.user.userid | 값이 직접 복사됨 |
| event_data.domain | security_result.about.administrative_domain | 값이 직접 복사됨 |
| event_data.url | security_result.about.url | 값이 직접 복사됨 |
| event_data.pe_action | security_result.action | ALLOW, BLOCK 또는 ALLOW_WITH_MODIFICATION에 매핑됨 |
| event_data.categories | security_result.category_details | event_data.categories(추출 또는 직접) 및 casb_cat_name에서 병합됨 |
| casb_cat_name | security_result.category_details | |
| event_data.risk_score | security_result.confidence_details | 값이 직접 복사됨 |
| content-type | security_result.detection_fields | 다양한 라벨 필드에서 병합됨 |
| 제품 | security_result.detection_fields | |
| 위협 | security_result.detection_fields | |
| virusDetails | security_result.detection_fields | |
| sandboxResult | security_result.detection_fields | |
| fullScanResult | security_result.detection_fields | |
| tab_id | security_result.detection_fields | |
| pe_reason | security_result.detection_fields | |
| ua_type | security_result.detection_fields | |
| email_isolation_state | security_result.detection_fields | |
| document_url | security_result.detection_fields | |
| archive_path | security_result.detection_fields | |
| casb_app_name | security_result.detection_fields | |
| casb_fun_name | security_result.detection_fields | |
| casb_org_name | security_result.detection_fields | |
| casb_profile_id | security_result.detection_fields | |
| casb_profile_name | security_result.detection_fields | |
| casb_profile_type | security_result.detection_fields | |
| casb_risk_score | security_result.detection_fields | |
| connId | security_result.detection_fields | |
| origin_country | security_result.detection_fields | |
| egress_country | security_result.detection_fields | |
| is_casb_ddl | security_result.detection_fields | |
| is_iframe | security_result.detection_fields | |
| parent_file_id | security_result.detection_fields | |
| parent_filename | security_result.detection_fields | |
| parent_sha256 | security_result.detection_fields | |
| parent_tid | security_result.detection_fields | |
| root_file_id | security_result.detection_fields | |
| root_filename | security_result.detection_fields | |
| root_sha256 | security_result.detection_fields | |
| casb_risk_score | security_result.risk_score | 부동 소수점 수로 변환됨 |
| casb_profile_id | security_result.rule_id | 값이 직접 복사됨 |
| pe_rulename | security_result.rule_name | 값이 직접 복사됨 |
| casb_profile_name | security_result.rule_set | 값이 직접 복사됨 |
| casb_profile_type | security_result.rule_type | 값이 직접 복사됨 |
| event_data.severity | security_result.severity_details | 값이 직접 복사됨 |
| magicName | security_result.summary | '%{magicName} is %{threats}.'로 연결됩니다. |
| 위협 | security_result.summary | |
| threat_types | security_result.threat_name | 값이 직접 복사됨 |
| origin_ip | src.ip | 값이 직접 복사됨 |
| origin_country | src.location.country_or_region | 값이 직접 복사됨 |
| event_data.dst | target.asset.ip | grok IP 패턴을 사용하여 event_data.dst 또는 dst에서 추출됨 |
| dst | target.asset.ip | |
| filename | target.file.full_path | 값이 직접 복사됨 |
| mimeType | target.file.mime_type | 값이 직접 복사됨 |
| sha256 | target.file.sha256 | 값이 직접 복사됨 |
| file_size | target.file.size | 부동 소수점 수로 변환한 후 uinteger로 변환 |
| event_data.dst | target.ip | grok IP 패턴을 사용하여 event_data.dst 또는 dst에서 추출됨 |
| dst | target.ip | |
| top_url | target.url | URI grok 패턴을 사용하여 추출됨 |
| metadata.product_name | metadata.product_name | 'MENLO SECURITY'로 설정합니다. |
| metadata.vendor_name | metadata.vendor_name | 'MENLO SECURITY'로 설정합니다. |
region |
event.idm.read_only_udm.principal.location.country_or_region |
변경 로그에서 매핑됨 |
region_name |
event.idm.read_only_udm.principal.location.name |
변경 로그에서 매핑됨 |
src_ip |
event.idm.read_only_udm.principal.ip 및 event.idm.read_only_udm.principal.asset.ip |
변경 로그에서 매핑됨 |
groups |
event.idm.read_only_udm.principal.group.product_object_id |
변경 로그에서 매핑됨 |
content-type |
event.idm.read_only_udm.security_result.detection_fields |
변경 로그에서 매핑됨 |
product |
event.idm.read_only_udm.security_result.detection_fields |
변경 로그에서 매핑됨 |
mimeType |
event.idm.read_only_udm.target.file.mime_type |
변경 로그에서 매핑됨 |
변경 로그
도움이 더 필요하신가요? 커뮤니티 회원 및 Google SecOps 전문가에게 문의하여 답변을 받으세요.