Spacebar Campaigns

DBL-001 PostgreSQL Connection and Query Log

Log ID:
DBL-001
Source:
PostgreSQL DB host
Representative Path:
/var/log/postgresql/postgresql-*.log
Collection:
Filebeat custom log input 또는 PostgreSQL module
Primary Use:
DB 접속 계정, 출발지, 쿼리 대상, 대량 조회 정황 확인

Log Structure

PostgreSQL 로그는 설정에 따라 접속/종료, 인증 실패, statement, duration, slow query 등을 남긴다. 실무형 분석에서는 모든 쿼리를 무조건 남기기보다, 실습 목적에 맞춰 접속 로그와 특정 statement 로그를 제한적으로 수집하는 것이 적절하다.

Important Fields

FieldMeaning
@timestampDB 이벤트 발생 시간
user.nameDB 접속 계정
database.name접속 대상 DB
source.ip접속 출발지
event.actionconnection, disconnection, statement 등
messagePostgreSQL 원본 로그

Mapped Techniques

TechniqueMapping Reason
T1213.006 Data from Information Repositories: DatabasesDB 조회와 데이터 접근 확인
T1078 Valid Accounts정상 DB 계정으로 접속했는지 확인

KQL Draft

service.type: "postgresql" and message: ("booking" or "reservation" or "customer")

Investigation Pivot

DB 접속 계정과 source IP를 기준으로 App 서버 환경 파일 접근 로그, SSH 접속 로그, Jenkins 배포 로그와 연결한다.