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.



No comments:

Post a Comment