
Syslog Server: รวม Logs จากอุปกรณ์ Network ด้วย Graylog
Syslog เป็น protocol มาตรฐานที่อุปกรณ์ network (switches, routers, firewalls, servers) ใช้ส่ง log messages ไปยัง centralized server การรวม logs ไว้ที่เดียวทำให้ troubleshoot ได้เร็ว ตรวจจับ security incidents ได้ง่าย และเก็บ logs สำหรับ compliance audit
Graylog เป็น open-source log management platform ที่ทรงพลัง รองรับ Syslog, GELF, JSON และ formats อื่นๆ มี search engine แรง (Elasticsearch/OpenSearch) dashboard สวย alerting ครบ เหมาะสำหรับองค์กรที่ต้องการ centralized logging โดยไม่ต้องจ่ายค่า license แพง
ทำไมต้อง Centralized Logging
| ไม่มี Centralized Logging | มี Centralized Logging |
|---|---|
| SSH เข้าแต่ละอุปกรณ์ดู logs | Search logs ทุกอุปกรณ์จากที่เดียว |
| Logs หายเมื่อ buffer เต็มหรือ reboot | Logs เก็บถาวรบน server |
| Correlate events ข้ามอุปกรณ์ยาก | Search + correlate ข้ามอุปกรณ์ง่าย |
| ไม่มี alerting | Alert เมื่อเกิด events สำคัญ |
| ไม่มี audit trail สำหรับ compliance | เก็บ logs ตาม retention policy |
Syslog Basics
Severity Levels
| Level | ชื่อ | ความหมาย | ตัวอย่าง |
|---|---|---|---|
| 0 | Emergency | ระบบ crash | System unusable |
| 1 | Alert | ต้องแก้ไขทันที | Database corrupted |
| 2 | Critical | สถานการณ์วิกฤต | Hardware failure |
| 3 | Error | Error conditions | Interface down |
| 4 | Warning | Warning conditions | Config change, high CPU |
| 5 | Notice | Normal but significant | Interface up, login success |
| 6 | Informational | Informational | ACL match, DHCP lease |
| 7 | Debug | Debug messages | Detailed troubleshooting |
Facility Codes
Facility บอกว่า log มาจาก process อะไร: kern (0), user (1), mail (2), daemon (3), auth (4), syslog (5), local0-7 (16-23) อุปกรณ์ network มักใช้ local0-7 สำหรับแยกประเภท logs
ตั้งค่า Syslog บนอุปกรณ์ Network
Cisco IOS
Commands: logging host [syslog-server-ip] logging trap informational (ส่ง severity 0-6) logging facility local7 logging source-interface Loopback0 service timestamps log datetime msec localtime
pfSense
GUI: Status → System Logs → Settings Enable Remote Logging ใส่ IP ของ syslog server เลือก log categories ที่ต้องการส่ง (firewall, DHCP, VPN)
Graylog Architecture
Components
Graylog Server: รับ logs, process, index, search, dashboard, alerting MongoDB: เก็บ configuration และ metadata OpenSearch/Elasticsearch: เก็บและ index log data (full-text search) ทั้ง 3 components ต้องทำงานร่วมกัน สำหรับ small deployment รันบนเครื่องเดียวได้ สำหรับ large deployment แยก servers
สิ่งที่ควร Log
| ประเภท | อุปกรณ์ | Severity | ใช้ทำอะไร |
|---|---|---|---|
| Interface Up/Down | Switches, Routers | Warning-Error | Detect link failures |
| Config Changes | ทุกอุปกรณ์ | Warning | Audit trail, change management |
| Authentication | ทุกอุปกรณ์ | Notice-Warning | Detect unauthorized access |
| Firewall Deny | Firewalls | Informational | Security monitoring |
| DHCP Lease | DHCP Server | Informational | Track IP assignments |
| VPN Tunnel | VPN Gateways | Notice-Error | VPN monitoring |
| CPU/Memory Alerts | ทุกอุปกรณ์ | Warning-Critical | Performance monitoring |
Graylog Features
Streams
Streams แยก logs ตามเงื่อนไข (rules): Stream “Firewall Logs”: source = firewall IPs Stream “Auth Failures”: message contains “authentication failure” Stream “Config Changes”: message contains “configured by” แต่ละ stream มี retention policy, alerts, dashboards แยกกัน
Dashboards
Dashboards แสดง visualizations: Top sources (อุปกรณ์ไหนส่ง logs มากสุด) Error count over time Auth failures by source IP Firewall deny top destinations สร้าง dashboard สำหรับ NOC (Network Operations Center)
Alerting
Alerts แจ้งเตือนเมื่อเกิด events สำคัญ: Alert เมื่อ interface down > 5 ครั้งใน 5 นาที Alert เมื่อ auth failure > 10 ครั้งจาก IP เดียวกัน Alert เมื่อ config change (audit) ส่ง alert ผ่าน email, Slack, webhook
Log Retention
| ประเภท | Retention แนะนำ | เหตุผล |
|---|---|---|
| Security Logs | 1-2 ปี | Compliance, forensics |
| Firewall Logs | 6-12 เดือน | Security analysis |
| Network Logs | 3-6 เดือน | Troubleshooting |
| Debug Logs | 7-30 วัน | ใช้ชั่วคราว volume สูง |
ทิ้งท้าย: Logs ที่ไม่ได้เก็บก็เหมือนไม่มี
Centralized Logging ด้วย Graylog ทำให้เห็นทุกอย่างที่เกิดขึ้นใน network จากที่เดียว ตั้ง syslog บนอุปกรณ์ทุกตัว ส่งไป Graylog สร้าง streams, dashboards, alerts เก็บ logs ตาม retention policy
อ่านเพิ่มเติมเกี่ยวกับ SNMP Monitoring NMS และ Network Troubleshooting ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com