Skip to main content

Logging Guideline

ข้อมูลการจัดเก็บ

Indices / Data streams format

รูปแบบการตั้งชื่อ index สำหรับจัดเก็บ log ให้ใช้รูปแบบดังนี้

Naming Format

{domain}-{app_name}-{environment}-{log type}

  • domain — ชื่อ domain ของระบบ
  • app_name — ชื่อแอปพลิเคชัน (ถ้ามี)
  • environment — สภาพแวดล้อม เช่น production, staging
  • log type — ประเภทของ log เช่น audit, error, authentication

ตัวอย่าง

Index NameDomainApp NameEnvironmentLog Type
sport-production-auditsport-productionaudit
sport-production-errorsport-productionerror
hr-dss-staging-errorhrdssstagingerror

Authentication Log — REQUIRED

เก็บข้อมูลการเข้าออกระบบ เช่น login, logout, เปลี่ยนรหัสผ่าน เป็นต้น

Log type: authentication

ข้อมูลที่จัดเก็บ

FieldRequiredDescription
username / user IDชื่อผู้ใช้หรือ ID ที่ทำ action
IP addressIP address ของผู้ใช้
actionaction ที่ดำเนินการ
agent (browser) detailรายละเอียด browser / user agent

Action ที่ต้องจัดเก็บ

  • Login
  • Logout
  • Change / Reset Password
  • PIN reset
  • Impersonate Login

Error Log — REQUIRED

เก็บข้อมูล error exception detail ภายในระบบ เพื่อใช้ในการ debug และตรวจสอบปัญหา

Log type: error

ข้อมูลที่จัดเก็บ

FieldRequiredDescription
exception detailรายละเอียดของ error / exception ที่เกิดขึ้น

Action ที่ต้องจัดเก็บ

  • Catch error (ทุก exception ที่เกิดขึ้นภายในระบบ)

Audit Log — REQUIRED

เก็บข้อมูล action ที่สำคัญภายในระบบ เช่น การกำหนดสิทธิ์ การ Create, Update, Delete ข้อมูล

Log type: audit

ข้อมูลที่จัดเก็บ

FieldRequiredDescription
username / user IDชื่อผู้ใช้หรือ ID ที่ทำ action
IP addressIP address ของผู้ใช้
actionaction ที่ดำเนินการ
agent (browser) detailรายละเอียด browser / user agent

Action ที่ต้องจัดเก็บ

  • ขึ้นอยู่กับระบบ เช่น การกำหนดสิทธิ์ผู้ใช้, CRUD ข้อมูลสำคัญ

Generic Log — optional

เก็บข้อมูลอื่น ๆ ที่ต้องการจัดเก็บนอกเหนือจาก log ประเภทข้างต้น

Log type: generic

Action ที่ต้องจัดเก็บ

  • ข้อมูลทั่วไปที่ต้องการบันทึก ขึ้นอยู่กับความต้องการของแต่ละระบบ

Email Log — optional

เก็บข้อมูลการส่งออก email จากระบบ เพื่อใช้ในการตรวจสอบและติดตามการส่ง email

Log type: email

Action ที่ต้องจัดเก็บ

  • การส่ง Email ออกจากระบบ (รวมถึงรายละเอียดผู้รับ, หัวข้อ, สถานะการส่ง)