Skip to content

alperenp/OS-Log-Collection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This document is created in order to present a how-to collect OS logs via using nxlog -> logstash -> rabbitmq setup.

Pre-requirements

Setup

This Setup instructions are tested on Windows machine.

  1. Install Java to your host machine
  2. Install nxlog to your host machine
  3. Install RabbitMQ to your host machine
  4. Download Logstash and extract folder on your host machine

RabbitMQ

  1. Create admin account in rabbitMQ in order to be able to create queues. You may optionally create accounts for different connections in order to not get authentication failures

  2. Create queue used in named as "rawLogs" rabbitQueues

  3. Create an exchange in rabbitMQ in order to receive logs from logstash


3.a. Call this exchange as "logstash".

exchangeCreate

3.b. Then bind this exchange into "rawLogs" queue. Now You can send logs from logstash and rabbit will direct logs to "rawLogs".

exchangeBindPNG

Nxlog

Configuration Sample

  1. Configure nxlog.conf file(under C:\Program Files\nxlog\conf\ ) Here is a sample

nxlog.conf

In the sample, eventlogs are written under the file (c:\nxlogOutput\nxlog.txt) in Route 1. Route 2 reads input from this file and currently occuring windows logs. Route 2 forwards these two inputs to logstash under logstash defined in "eventlog_outLogStash".

  1. One can start-stop nxlog service under windows services

Note: For more details please see user guide

LogStash

  1. Go to the logstash/bin directory (~\logstash-6.1.3\bin)
  2. Create a config file named logstash-simple.conf
  3. Fill the logstash config file. Here is an example.

logstash.conf

In the sample, previously configures nxlog configuration is defined under input tag. Under filter, each log is added with the fields of "SourceIp" and "id". Finally logs are forwarded to rabbitMQ configured under output tag.

  1. Open command line under current directory (~\logstash-6.1.3\bin)
  2. Execute the command logstash.bat -f logstash-simple.conf

Note: if you get RabbitMQ connection error, will retry. {:error_message=>"Connection to <RABBITMQ_ADDRESS>:5672 refused", :exception=>"MarchHare::ConnectionRefused"}, try to make an inbound firewall rule, in the machine where rabbitmq installed, for 5672 port

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published