Showing posts with label nxlog. Show all posts
Showing posts with label nxlog. Show all posts

nxlog ssl tls

nxlog.conf file for sending logs over ssl. Copy this file from server /opt/data/etc/remote_connection/certificates/ca.crt
to windows machine . c:\Program Files\nxlog\cert

Replace 192.168.15.118 ip with your siem server ip then restart the nxlog service from the Window system.



Panic Soft

define ROOT C:\Program Files\nxlog

#ModuleDir %ROOT%\modules
#CacheDir %ROOT%\data
#SpoolDir %ROOT%\data

define CERTDIR %ROOT%\cert
define CONFDIR %ROOT%\conf

# Note that these two lines define constants only; the log file location
# is ultimately set by the `LogFile` directive (see below). The
# `MYLOGFILE` define is also used to rotate the log file automatically
# (see the `_fileop` block).
define LOGDIR %ROOT%\data
define MYLOGFILE %LOGDIR%\nxlog.log

# By default, `LogFile %MYLOGFILE%` is set in log4ensics.conf. This
# allows the log file location to be modified via NXLog Manager. If you
# are not using NXLog Manager, you can instead set `LogFile` below and
# disable the `include` line.
#LogFile %MYLOGFILE%
LogLevel INFO
LogFile %MYLOGFILE%
#include %CONFDIR%\log4ensics.conf

<Extension _syslog>
Module xm_syslog
</Extension>
<Extension _exec>
Module xm_exec
</Extension>

<Extension _json>
Module xm_json
</Extension>

<Input in>
Module im_msvistalog
ReadFromLast TRUE
<QueryXML>
<QueryList>
<Query Id='1'>
<Select Path='Application'>*</Select>
<Select Path='Security'>*</Select>
<Select Path='System'>*</Select>
</Query>
</QueryList>
</QueryXML>
</Input>

<Output out>
#Module om_tcp
Module om_ssl
Host 192.168.15.118
Port 515
CAFile %CERTDIR%/ca.crt
AllowUntrusted TRUE
Exec to_json();$Message=$raw_event;to_syslog_bsd();
</Output>

<Route 1>
Path in => out
</Route>

Please let us know if this helped you or not.

nxlog iis

Panic Soft
### Start off with Definitions ###
define ROOT C:\Program Files (x86)\nxlog
define CERTDIR %ROOT%\cert
define CONFDIR %ROOT%\conf
define LOGDIR %ROOT%\data
define LOGFILE %LOGDIR%\nxlog.log
LOGFILE %LOGDIR%\nxlog.log

Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
LogLevel INFO
#PersistLogqueue TRUE
#SyncLogqueue TRUE
#CacheFlushInterval always
#CacheSync TRUE

<Extension _syslog>
Module xm_syslog
</Extension>

<Extension xml>
Module xm_xml
</Extension>

<Extension _exec>
Module xm_exec
</Extension>

<Extension _json>
Module xm_json
</Extension>

<Extension w3c>
Module xm_csv
Fields $date, $time, $s-ip, $cs-method, $cs-uri-stem, $cs-uri-query, $s-port, $cs-username, $c-ip, $cs(User-Agent), $sc-status, $sc-substatus, $sc-win32-status, $time-taken
FieldTypes string, string, string, string, string, string, integer, string, string, string, integer, integer, integer,integer
Delimiter ' '
QuoteChar '"'
EscapeControl FALSE
UndefValue -
</Extension>

<Extension _fileop>
Module xm_fileop

# Check the size of our log file every hour and rotate if it is larger than 5Mb
<Schedule>
Every 1 hour
Exec if (file_exists('%LOGFILE%') and (file_size('%LOGFILE%') >= 5M)) file_cycle('%LOGFILE%', 8);
</Schedule>
</Extension>



### Get IIS Exchange logs ###

<Input IIS_log>
Module im_file
File "D:\\Inetlogs\\W3SVC1\\\\u_ex*.log"
InputType LineBased
SavePos TRUE
#Drop info legend lines
Exec if $raw_event =~ /^\#/ drop();\
else\
{\
w3c->parse_csv();\
$EventTime = parsedate($date + " " +$time);\
$date = strftime($EventTime, "%Y-%m-%d");\
}
Exec $Message = $raw_event;\
#Exec $date = strftime($EventTime, "'%Y-%m-%d"); $time = strftime($EventTime, "%H:%M:%S");
</Input>


### Define the output that goes to SIEM for analysis ###

<Output logcontents1>
Module om_tcp
Host SIEM_IP
Port 514
Exec $Hostname = hostname_fqdn();
Exec to_json();
</Output>

### Tie together inputs to outputs ###

<Route r_lp2>
Path IIS_log => logcontents1
</Route>

------------------------------------------------
To pull windows event log All you need to do is add the log name into the query list.

Query <QueryList>\
<Query Id="0">\
<Select Path="Application">*</Select>\
<Select Path="System">*</Select>\
<Select Path="Security">*</Select>\
<Select Path="DNS Server">*</Select>\
<Select Path="Directory Service">*</Select>\
<Select Path="DFS Replication">*</Select>\
<Select Path="Active Directory Web Services">*</Select>\
</Query>\
</QueryList>
To find the name of the log you want to add the easiest way is to

open event viewer

select custom view

select the event logs you want from the dropdown

switch to the XML tab

It will have a very similar look but you have to make it look exactly like my code above. Note the backslash at the end.