Setting up a syslog server and forwarder is an optional step for your Jormungandr node on a Windows computer. It may becomes useful in future testnet phases.
There are many different Syslog servers available for windows. For this guide we will rely on the free and open-source community Edition of NXLog.
First, download the most recent pre-compiled windows binary from the NXLog download page
After a default installation, I recommend editing the config file in
C:\Program Files (x86)\nxlog\conf\nxlog.conf
You can change the log folder by manually creating the subfolder /logs in the existing nxlog/data directory (optionally enable NTFS compression).
define LOGDIR %ROOT%\data\logs
If your windows system has a separate data partition (eg D:\ ) it is a good idea to create a D:\nxlog directory and subfolders \cache \log and \spool. Then change the config like this:
... define DATADIR d:\nxlog define LOGFILE %DATADIR%\log\nxlog.log LogFile %LOGFILE% Moduledir %ROOT%\modules CacheDir %DATADIR%\cache Pidfile %DATADIR%\nxlog.pid SpoolDir %DATADIR%\spool ...
Next let’s add some input- and output-modules and pair it with a forwarding route.
We listen for standard IETF Syslog messages as input on UDP IP 127.0.0.1 port 514, and (for now) we want the messages written to a local output logfile.
The Route directive connects the defined input to output module.
<Input ietf> Module im_udp Host 127.0.0.1 Port 514 Exec parse_syslog_ietf(); </Input> <Output file> Module om_file File "D:/nxlog/log/sys.log" <Schedule> When @daily <Exec> file_cycle(file_name(), 30); reopen(); </Exec> </Schedule> </Output> <Route ietf_to_file> Path ietf => file </Route>
Now it’s time to start the NXLog service in the Windows > Computer management > Services list. The service was installed during NXLog setup and is configured to autostart after the operating system boots up next time.
You should see both nxlog.log and sys.log files in the configured nxlog > log folder. If the service does not start as expected you may see the reason in the NXLog install/data folder.
Test the setup by generating some test syslog messages by downloading the SysLogGen command line tool (see page bottom) and execute the tool with these parameters
SyslogGen.exe -t:127.0.0.1 -f:1 -s:7 -tg:test -m:"Hello from Sys to Log"
You can now add a second output directive to send the incoming syslog messages also to a remote syslog server
<Output testnetsyslog> Module om_udp Host [ip.ad.re.ss] Port 514 </Output> <Route ietf_to_testnetsyslog> Path ietf => testnetsyslog </Route>
Now the incoming message is forwarded to both your local logfile and the remote syslog server.