11/01/2560

การส่ง Log จาก Windows มายัง Graylog























เมื่อทำการติดตั้ง Graylog Server เสร็จเรียบร้อยแล้ว จะต้องตั้งค่า เครื่อง Client ให้ส่ง Log ไปเก็บที่เครื่อง Server ด้วย โดย Client ที่เป็น Windows สามารถทำการตั้งค่าได้ตามนี้

ให้ทำการDownload Software ที่มีชื่อว่า NxLog





ติดตั้ง ตามปกติ Next Wizard อย่างเดียว


หลังจากนั้น พอติดตั้งเสร็จ ให้ไปที่ Path ติดตั้ง nxlog เพื่อทำการแก้ไขไฟล์Config ที่ชื่อว่า nxlog.conf
เช่น C:\Program Files (x86)\nxlog\conf


เมื่อเปิดมา ให้ copy&paste command ด้านล่างทับลงไป  โดย ตรง host.example.com  ให้แก้ไขเป็น Ip address  graylog-server ที่ต้องการจะส่งlogไป หลังจากนั้น saveไฟล์

## This is a sample configuration file. See the nxlog reference manual about the
## configuration options. It should be installed locally and is also available
## online at http://nxlog.org/nxlog-docs/en/nxlog-reference-manual.html
## Please set the ROOT to the folder your nxlog was installed into,
## otherwise it will not start.
#define ROOT C:\Program Files\nxlog
define ROOT C:\Program Files (x86)\nxlog
Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
LogFile %ROOT%\data\nxlog.log
<Extension gelf>
Module xm_gelf
</Extension>
<Input in>
# Use 'im_mseventlog' for Windows XP and 2003
Module im_msvistalog
Exec if ($EventID == 4202 or $EventID == 4208 or $EventID == 4302 or $EventID == 4304 or $EventID == 5004) drop();\
else{\
if ( $EventType == "INFO" ) $SyslogSeverityValue = 6;\
if ( $EventType == "WARNING" ) $SyslogSeverityValue = 4;\
if ( $EventType == "ERROR" ) $SyslogSeverityValue = 3;\
}
</Input>
<Output out>
Module om_udp
Host host.example.com //Ip-address
Port 12201
OutputType GELF
</Output>
<Route 1>
Path in => out
</Route>

หลังจากนั้น จะให้มัน Take Effect ก็ต่อเมื่อทำการ Restart Service ก่อน ให้เข้าไปที่ Administrative tools >> Services
หรือจะเข้าอีกแบบ คือ Window Start >> Run >> services.msc ให้หา service ที่ชื่อ nxlog  แล้วทำการ start ขึ้นมา


เท่านี้ก็เสร็จสิ้นการ config ส่ง eventlog ของ windows

ไม่มีความคิดเห็น:

แสดงความคิดเห็น