Skip to content

匯出稽核報表

何時用這份文件 你要產出可交付的稽核報表 — 給管理層、外部 auditor、或法遵留存。

前置條件

三種匯出格式

格式用途工具鏈
CSV給 Excel / Google Sheets 分析直接打開或 import
JSON Lines灌進 ELK / Splunk / BigQuery / 數倉自家 ETL pipeline
Signed Manifest外部稽核 — 證明資料未被竄改含 hash chain root

步驟

1. 確認時間範圍與條件

報表標準範圍:

類型範圍條件
週報過去 7 天全動作
月報上一個自然月全動作
季報上一個自然季全動作 + 完整性 manifest
年度合規自然年全動作 + 月度 manifest 串接
事件覆盤事件 ±24h該事件相關 resource
特定 user 稽核任務期間actor:user/login_id=<id>

2. 預演查詢

在匯出查詢 audit log 確認筆數合理:

bash
curl -s -H "Authorization: Bearer $TOKEN" \
  --data-urlencode "filter=timestamp>=2026-04-01T00:00:00Z AND timestamp<2026-05-01T00:00:00Z" \
  "$ARGUS/v1/auditLogs?pageSize=1&showTotalSize=true" \
  | jq '.totalSize'

預期看到合理筆數(一個中型公司一個月通常 10k – 100k 筆)。

筆數異常少 → 可能 filter 寫錯;筆數異常多 → 可能漏限縮條件。

3. 觸發匯出

bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  -d '{
    "filter": "timestamp>=2026-04-01T00:00:00Z AND timestamp<2026-05-01T00:00:00Z",
    "format": "CSV"
  }' \
  "$ARGUS/v1/auditLogs:export" \
  --output 2026-04-audit.csv
bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  -d '{
    "filter": "timestamp>=2026-04-01T00:00:00Z AND timestamp<2026-05-01T00:00:00Z",
    "format": "JSONL"
  }' \
  "$ARGUS/v1/auditLogs:export" \
  --output 2026-04-audit.jsonl
bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  -d '{
    "filter": "timestamp>=2026-04-01T00:00:00Z AND timestamp<2026-05-01T00:00:00Z",
    "format": "MANIFEST",
    "includeHashChain": true
  }' \
  "$ARGUS/v1/auditLogs:export" \
  --output 2026-04-audit.manifest.zip

從 UI:Audit Log → Export → 選 format → 下載。

4. 驗證輸出

匯出後一定檢查:

bash
# CSV 行數應等於查詢時的 totalSize + 1(header)
wc -l 2026-04-audit.csv

# JSON Lines 每行可單獨解析
jq -c . 2026-04-audit.jsonl > /dev/null      # 若全部有效,無錯誤輸出

# Manifest(含 hash chain)
unzip -l 2026-04-audit.manifest.zip
# 預期看到:data.jsonl、manifest.json、signature.sig

5. 驗證 Manifest 簽章(僅 MANIFEST 格式)

bash
# 解壓
unzip 2026-04-audit.manifest.zip -d manifest-2026-04

# 驗證簽章(使用 Argus 公開驗證 key)
openssl dgst -sha256 -verify argus-audit-public.pem \
  -signature manifest-2026-04/signature.sig \
  manifest-2026-04/manifest.json
# 預期:Verified OK

manifest.json 結構:

json
{
  "exportedAt": "2026-05-23T10:00:00Z",
  "exportedBy": "user/login_id=external-auditor-2026",
  "filter": "timestamp>=2026-04-01T00:00:00Z AND timestamp<2026-05-01T00:00:00Z",
  "totalRecords": 47823,
  "firstRecordHash": "sha256:...",
  "lastRecordHash":  "sha256:...",
  "chainRootBefore": "sha256:...",
  "chainRootAfter":  "sha256:..."
}

驗證流程:

  1. data.jsonl 重新計算 hash chain
  2. 比對 firstRecordHash / lastRecordHash 與 manifest 一致
  3. 比對 chainRootBefore / chainRootAfter 與 Argus 月度公告的 root 一致
  4. 簽章驗證通過

四項全成立 = 這份資料自匯出以來未被改動 + 與 Argus 內部紀錄一致

報表內容建議

月報必含

  • 期間總動作數 / 各 action 分佈
  • 各 environment 變更次數
  • 平均審批時長 / 失敗率 / 重試率
  • 高風險變更清單(含 actor + 結果)
  • 凍結期變更(理應 0)
  • IAM 異動摘要(誰被加 / 撤 / 升)
  • 異常登入(失敗潮、新 IP、新地理)
  • Setting 異動(特別 EMERGENCY_PAUSE / WORKSPACE_APPROVAL 變動)

給管理層的單頁

從上面挑 4-6 個指標做趨勢圖。不要塞表格給管理層看。

給外部 auditor

  • Signed manifest 是核心交付
  • 附一份說明文件:欄位定義、簽章驗證流程、聯絡窗口
  • 給外部用 readOnlyAuditor 帳號(無 mutation 權限)

排程匯出(roadmap)

未來會支援 cron 排程匯出到 S3 / 內部存儲。當前用外部 cron 觸發 API:

bash
# /etc/cron.monthly/argus-audit-export
#!/bin/bash
set -euo pipefail

MONTH=$(date -d 'last month' +%Y-%m)
START="${MONTH}-01T00:00:00Z"
END="$(date -d "$START +1 month" -u +%Y-%m-%dT%H:%M:%SZ)"

curl -X POST -H "Authorization: Bearer $ARGUS_AUDITOR_TOKEN" \
  -d "{\"filter\":\"timestamp>=$START AND timestamp<$END\",\"format\":\"MANIFEST\",\"includeHashChain\":true}" \
  "$ARGUS/v1/auditLogs:export" \
  --output "/srv/argus-audit/audit-$MONTH.manifest.zip"

# 上傳 off-site
aws s3 cp "/srv/argus-audit/audit-$MONTH.manifest.zip" \
  "s3://corp-audit/argus/$MONTH.manifest.zip" --sse=AES256

不要做的事

反模式為什麼
用 admin 帳號匯出actor 不純,混進去其他動作
不驗證 manifest 簽章簽章是稽核可信度的核心
把 manifest 拆檔分送簽章對應整包;拆開無法驗證
修改匯出檔(改格式 / 過濾敏感欄位)違反 tamper-proof 設計
給外部 auditor mutation 權限違反零信任

相關

Argus — 公司內部資料庫變更審計平台