Ask questions. Get answers. Find technical product solutions from passionate experts in the NXLog community.
NXlog-CE-3.0.2272 and Microsoft-Windows-PrintService
vm_grrl created
I've configured NXlog to send printing events from our Windows 2012R2 print server to our Nagios LS instance. **Except **for the following issue, it works well.
The issue is - when a filename contains a "%" sign, I receive a _grokparsefailure in Nagios. That led me to NXLog-CE and how it (and its modules) read/parsed the data from the Microsoft Windows PrintService Event Log. I enabled troubleshooting by means of debug AND outputting the $raw_event to a text file.
Is there a way I can get this document name from the Windows Event Viewer into Nagios via NXlog-CE? This issue looks similar to this thread, which says the problem is with the provider: https://nxlog.co/question/2362/problem-windows-event
DEBUG OUTPUT:
{"EventTime":"2022-02-11 10:38:48","Hostname":"xxx.yyy.zzz","Keywords":4611686018427390016,"EventType":"INFO","SeverityValue":2,"Severity":"INFO","EventID":307,"SourceName":"Microsoft-Windows-PrintService","ProviderGuid":"{xxxxxxx}","Version":0,"Task":26,"OpcodeValue":11,"RecordNumber":2136143,"ProcessID":4764,"ThreadID":6728,"Channel":"Microsoft-Windows-PrintService/Operational","Domain":"XXXX","AccountName":"QQQQ","UserID":"SID-aaa-bbb-ccc","AccountType":"User",**"ERROR_EVT_UNRESOLVED":true**,"Category":"Printing a document","Opcode":"Spooler Operation Succeeded","EventReceivedTime":"2022-02-11 10:38:50","SourceModuleName":"eventlog","SourceModuleType":"im_msvistalog","message":null}
$raw_event OUTPUT:
2022-02-11 10:38:48 xxx.yyy.zzz INFO 307 XXXX\QQQQ[The description for EventID 307 from source Microsoft-Windows-PrintService cannot be found: **The substitution string for insert index (%1) could not be found**. ]
CONFIG:
define ROOT C:\Program Files\nxlog
define CERT %ROOT%\cert
Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
LogFile %ROOT%\data\nxlog.log
<Extension json>
Module xm_json
</Extension>
<Extension syslog>
Module xm_syslog
</Extension>
<Input internal>
Module im_internal
</Input>
<Input eventlog>
Module im_msvistalog
<QueryXML>
<QueryList>
<Query Id="0">
<Select Path="System">*[System[Provider[@Name='Srv'] and (Level=1 or Level=2 or Level=3)]]</Select>
<Select Path="Microsoft-Windows-PrintService/Admin">*[System[(Level=1 or Level=2 or Level=3)]]</Select>
<Select Path="Microsoft-Windows-PrintService/Operational">*</Select>
</Query>
</QueryList>
</QueryXML>
</Input>
<Output out>
Module om_tcp
Host qqq.yyy.zzz
Port 1234
Exec $tmpmessage = $Message; delete($Message); rename_field("tmpmessage","message");
Exec $raw_event = to_json();
</Output>
<Route 1>
Path internal, file1, eventlog => out
</Route>
vm_grrl created
Nxlog CE 3.0.2272 - High CPU Usage
ortega87 created
Hi everyone
After the update of the Nxlog community to the last version(3.0.2272) the consumption of CPU had a huge increase. The configuration basic work over the im_file module.
<Input fake>
Module im_file
File "C:\fakedir\logs\fake_file*"
SavePos TRUE
Exec if $raw_event =~ /^#/ drop();
else
{
w3c->parse_csv();
$EventTime = parsedate($date + " " + $time);
$Message = to_json();
}
</Input>
Is there someone that had the same issue with this version?
ortega87 created
FIM output to logstash has a mismatch Json format
steven.su created
Hi team, i use the FIM module to monitor a test file and output it to 2 destination: local file and remote logstash with tcp.
Now I could see the log in local file, but remote logstash fails to parse the log with json. After checking the log, i figure out that the log received by logstash is different:
Local:
{"EventTime":"2022-02-13T16:11:50.094508+08:00","EventType":"CHANGE","Object":"FILE","PrevFileName":"c:\users\test\desktop\test20220211.txt","PrevModificationTime":"2022-02-11T19:18:59.925713+08:00","FileName":"c:\users\test\desktop\test20220211.txt","ModificationTime":"2022-02-13T16:10:53.402144+08:00","PrevFileSize":6,"FileSize":10,"DigestName":"SHA1","Digest":"31ca8d2ae67b53db43d3581974d12a48c648eca5","PrevDigest":"1b1e2aa8fb50e43dd20429afdbbec1b81b153853","Severity":"WARNING","SeverityValue":3,"EventReceivedTime":"2022-02-13T16:11:50.094508+08:00","SourceModuleName":"fim","SourceModuleType":"im_fim"}
Logstash:
[2022-02-13T08:11:49,919][ERROR][logstash.codecs.json ][main][2869f035623bc8e694e78ee6b779cd6214f6eba705fdae0bea0b55fadc035072] JSON parse error, original data now in message field {:message=>"Unexpected character ('-' (code 45)): Expected space separating root-level values\n at [Source: (String)"2022-02-13 16:11:50 HKLAP0240 WARNING EventType="CHANGE" Object="FILE" PrevFileName="c:\\users\\test\\desktop\\test20220211.txt" PrevModificationTime="2022-02-11 19:18:59" FileName="c:\\users\\test\\desktop\\test20220211.txt" ModificationTime="2022-02-13 16:10:53" PrevFileSize="6" FileSize="10" DigestName="SHA1" Digest="31ca8d2ae67b53db43d3581974d12a48c648eca5" PrevDigest="1b1e2aa8fb50e43dd20429afdbbec1b81b153853" SeverityValue="3""; line: 1, column: 6]", :exception=>LogStash::Json::ParserError, :data=>"2022-02-13 16:11:50 HKLAP0240 WARNING EventType="CHANGE" Object="FILE" PrevFileName="c:\\users\\test\\desktop\\test20220211.txt" PrevModificationTime="2022-02-11 19:18:59" FileName="c:\\users\\test\\desktop\\test20220211.txt" ModificationTime="2022-02-13 16:10:53" PrevFileSize="6" FileSize="10" DigestName="SHA1" Digest="31ca8d2ae67b53db43d3581974d12a48c648eca5" PrevDigest="1b1e2aa8fb50e43dd20429afdbbec1b81b153853" SeverityValue="3""}
{
"tags" => [
[0] "jsonparsefailure"
],
"message" => "2022-02-13 16:11:50 HKLAP0240 WARNING EventType="CHANGE" Object="FILE" PrevFileName="c:\\users\\test\\desktop\\test20220211.txt" PrevModificationTime="2022-02-11 19:18:59" FileName="c:\\users\\test\\desktop\\test20220211.txt" ModificationTime="2022-02-13 16:10:53" PrevFileSize="6" FileSize="10" DigestName="SHA1" Digest="31ca8d2ae67b53db43d3581974d12a48c648eca5" PrevDigest="1b1e2aa8fb50e43dd20429afdbbec1b81b153853" SeverityValue="3"",
"@version" => "1",
"host" => "53959da2d559",
"@timestamp" => 2022-02-13T08:11:49.924Z,
"path" => "/opt/nxlog/var/log/nxlog/logmessage.log",
"type" => "json"
}
It seems the "2022-02-13 16:11:50 HKLAP0240 WARNING " is added only in the tcp stream and could not be identified as Json format by logstash. Is it normal to see the scenario and is there any workaround? Thank you.
steven.su created
Source code — download old version(s)
Ivan_Ivanovich created
Hi guys! I'm wondering where to download nxlog community edition version 2.11. The link I have doesn't work anymore — https://nxlog.co/system/files/products/files/348/nxlog-ce-2.11.2190.tar.gz
I'm not sure whether it's ok or not for project I'm currently working on to switch to version 3 of nxlog.
Could it be possible to keep old source code archives on nxlog's website?
(I've also looked through gitlab, but unfortunately there is no version tags too...)
Ivan_Ivanovich created
Issue with encoding french sysmon events
mldi created
Hello All,
I have an issue with sysmon logs. When they contain characters "è" like on word "système" nxlog convert it to "Syst�me".
Could you please tell me how I can resolve this issue ?
I've already tested the instructions bellow, but I always have an issue
<Extension charconv>
Module xm_charconv
AutodetectCharsets iso8859-1, utf-8, utf-16, utf-32
</Extension>
<Input input>
Exec convert_fields("auto", "utf-8");
</Input>
Best regards,
mldi created
NXLog.conf files issues
Drew.Ferguson created
Converting events to Snare format and sending them out over TCP syslog
<Output out>
Module om_tcp
Host 192.168.1.1
Port 514
Exec to_syslog_snare();
Can someone please tell me what's the purpose of the HOST IP, by default it's set to 192.168.1.1.
What exactly should it be?
Thanks
Drew.Ferguson created
How to write windows events to a new file every 1 min
gtarone created
Hi All,
I want to write windows events to a new file every 1 min.
As of now, I have the following Output block in my conf which works. It is given below,
<Output file>
Module om_file
File "C:\\Program Files (x86)\\nxlog\\data\\nxlog-output.json"
<Schedule>
Every 1 min
Exec rotate_to(file_name() + strftime(now(), '_%Y-%m-%d_%H-%M-%S'));
</Schedule>
</Output>
But in this case, I always write to the same file i.e "C:\Program Files (x86)\nxlog\data\nxlog-output.json" and after 1 min, the data is saved in other file with naming convention mentioned above.
I want to create a new file every 1 min with above naming convention and then write to that file instead of writing to the same file.
**How can I do this? Admins please guide. **
gtarone created
SQLBindPatrameter error
tothr2 created
2022-02-08 04:16:56 INFO [CORE|main] nxlog-5.4.7313-trial started on Windows
2022-02-08 04:16:56 INFO [im_odbc|reading_integer_id] im_odbc successfully connected to the database
2022-02-08 04:16:56 ERROR [im_odbc|reading_integer_id] SQLBindParameter failed, HY104:2:0:[Microsoft][ODBC SQL Server Driver]Invalid precision value (odbc error code: -1)
<Input reading_integer_id>
Module im_odbc
SavePos True
idType integer
ConnectionString Driver={SQL Server}; Server=xxxxxxxx;Database=SCSPDB;
UID=xxxxt;PWD=xxxxxx;
SQL SELECT Event_ID AS id, * FROM dbo.CSPEVENT_VW WHERE Event_ID > ?
Exec delete($id);
</Input>
Used CAST but still the same error
tothr2 created
nxlog receives termination signal on Windows Server
Massimiliano created
Hello,
I have this problem on the servers of one of my clients: nxlog receives a termination signal many times a day, and it closes. Then it restarts, sometimes instantly, other times after a random amount of time.
I can't identify the source of the signal, but this happens only on the servers of one of my clients. On the Windows eventviewer only show that nxlog service has stopped and then restarted.
I tried updating from 2.9.1716 to 3.0.2272, but this behaviour didn't change.
This is what I see in the nxlog.log everyday:
2022-02-07 00:25:12 WARNING stopping nxlog service
2022-02-07 00:25:12 WARNING nxlog-ce received a termination request signal, exiting...
2022-02-07 00:26:12 INFO nxlog-ce-3.0.2272 started
2022-02-07 01:59:14 WARNING stopping nxlog service
2022-02-07 01:59:14 WARNING nxlog-ce received a termination request signal, exiting...
2022-02-07 02:00:14 INFO nxlog-ce-3.0.2272 started
2022-02-07 03:49:15 WARNING stopping nxlog service
2022-02-07 03:49:15 WARNING nxlog-ce received a termination request signal, exiting...
2022-02-07 03:50:16 INFO nxlog-ce-3.0.2272 started
2022-02-07 05:42:17 WARNING stopping nxlog service
2022-02-07 05:42:17 WARNING nxlog-ce received a termination request signal, exiting...
2022-02-07 05:43:17 INFO nxlog-ce-3.0.2272 started
2022-02-07 07:34:18 WARNING stopping nxlog service
2022-02-07 07:34:18 WARNING nxlog-ce received a termination request signal, exiting...
2022-02-07 09:24:20 INFO nxlog-ce-3.0.2272 started
The last time it stopped this morning, it stayed off around 2 hours. I think it's the Windows service control that restarts it, but sometimes it fails or get delayed somehow, but I can't prove it: there's nothing on the windows logs apart from the service start/stop notice.
I searched the forums and see others have this problem, but cannot find a real solution or hint on where to search.
Massimiliano created
Steps to configure HTTPS for NxLog Manager
DSSLIM created
Hi, I’m looking for the steps to configure HTTPS for NxLog Manager using a CA signed cert. The doc provided is very limited.
Please kindly advise. Thanks !
DSSLIM created
Adjust timezone windows events sending Graylog
romuloforato created
I need some help. I need the events received in the graylog, to be in the local date/time here in Sao Paulo_Brazil.
In the moment, is showed of the Africa timezone...
romuloforato created
NXLOg CE 3.0.22 Memory Leak / 2.11 Download
cyberkryptoin created
Dear All,
Has anyone else found issues with the latest Nxlog V3.0.22 in terms of memory. I upgraded a test system on a client and it was usng spiking up to 40% of CPU whereease 2.10 did not do this.
Also, is it possible to download 2.11.90 as the download link appears to have been removed. I even found this issue on Gitlab https://gitlab.com/nxlog-public/nxlog-ce/-/issues/17, however the link does not work.
Does anyone know if there is a repository of releases?
Cheers
Cyberkryption
cyberkryptoin created
Regex and NXlog
farrisk01 created
Given:
<Exec>
if ($EventID == 5156) OR ($EventID == 5158)
drop();
else if ($Channel == 'Security') and ($EventID == 4624)
$Message =~ s/\s*This event is generated when a logon session is created.*$//s;
else if ($Channel == 'Security') and ($EventID == 4634)
$Message =~ s/\s*This event is generated when a logon session is destroyed.*$//s;
# Update the $raw_event field
$raw_event = $EventTime + ' ' + $Message;
</Exec>;
If I understand this correctly when an eventID of 4624 or 4634 is received a substitution is performed on the message field and the orginal contents are replaced with nothing(null). Am I correct or at least close? If so, what is does 's' before the ';' mean?
farrisk01 created
Error 1053 - service nxlog windows
romuloforato created
Hi, thanks for the post, it helped me a lot.
I did according to the video, but when I started the nxlog service, an error appeared:
"Windows could not start the nxlog service on local computer
"Error: 1053 The service did not respond to the start or control request in timely fashion"
I will be grateful if you can answer !
Tks.
romuloforato created
Access to WSL files from Windows
fnix created
Following the documentation to receive the logs from docker, the module configuration for a Linux configuration is the following :
<Input in>
Module im_file
File '/var/lib/docker/containers/*/*-json.log'
<Exec>
parse_json();
$HostID = file_basename(file_name());
$HostID =~ s/-json.log//;
</Exec>
</Input>
However, in Windows, docker is running inside a WSL2 instance. this is why I replace the path with the docker for desktop equivalent :
\\\\wsl$\docker-desktop-data\version-pack-data\community\docker\containers\\*-json.log
Now, this works only if we launch nxlog from a cmd terminal, with the -f option to run in foreground.
When it is running as a Windows service, it throws an error, unable to access the files. It seems it can't resolve the \\wsl$ in the path
How to access Docker WSL2 logs from Windows ?
fnix created
How to uninstall nxlog.exe - please help
virtualchi created
Hi
I have a windows server core 2016 and need help uninstalling nxlog. Not sure who installed it.
I don't have the installer or know exactly what version I have.
c:\Program Files (x86)\nxlog\nxlog.exe" -c "c:\Program Files (x86)\nxlog\conf\nxlog.conf"
I don't think this below helps since I don't know the version. I think is a 32bit.
> msiexec /x nxlog-5.4.7313_windows_x64.msi /qb
virtualchi created
Unexpected Exec block error
molnar_istvan_ofsz created
I am use nxlog ce edition for a few log file handling and parsing on windows.
This files needs a little parsing and rewriting, what i tryed like this:
<Input from_HS_info>
Module im_file
ReadFromLast true
SavePos true
RenameCheck true
InputType ml_main
File "L:\HS[A-Z]*.log"
<Exec>
$ReadFilename = file_name();
if ( $ReadFilename =~ /^([A-Za-z]+)_[A-Za-z_0-9]*RNTOFSZ_(OFSZIMHTR\d+).*\.log$/ ) {
$AccountName = $1;
$Hostname = $2;
}
# Remove extra spaces
$raw_event = replace($raw_event,'\s\s+1',' ');
$Channel = 'Software';
$AcountType = 'Porcess';
$Severity = 'INFO';
$Message = $raw_event
$Tags = '["' + $AccountName + '", "prod", "Instant Money" ]';
$raw_event = 'InstantMoney ' + $raw_event;
</Exec>
This snippet starts on line 72 and ends on line 98.
When I try to start it sneds an error message to the log file (nxlog.log):
2022-01-24 16:31:54 ERROR Couldn't parse Exec block at C:\Program Files (x86)\nxlog\conf\nxlog.conf:80; couldn't parse statement at line 92, character 13 in C:\Program Files (x86)\nxlog\conf\nxlog.conf; syntax error, unexpected TOKEN_FIELDNAME, expecting ;
Can anyone help me to correct this?
molnar_istvan_ofsz created
NXLog CE Packages for Bullseye
codeweavers created
Hiya,
Just wondering when the packages for Bullseye are going to be released for the Community Edition? I can see there's one already for Enterprise Edition.
I have also just checked that it builds OK on Bullseye and I can't see any problems, so it looks like it should be an easy one?
Thanks,
Rob
codeweavers created
WARNING input file was deleted
farrisk01 created
Hi,
I'm receiving the follow errors in nxlog.log:
2022-01-20 10:11:18 WARNING input file was deleted: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\SPAPP12013-20220106-0939.log
2022-01-20 10:41:19 WARNING input file was deleted: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\SPAPP12013-20220106-1009.log
2022-01-20 11:11:17 WARNING input file was deleted: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\SPAPP12013-20220106-1039.log
2022-01-20 11:41:19 WARNING input file was deleted: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\SPAPP12013-20220106-1109.log
2022-01-20 12:11:19 WARNING input file was deleted: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\SPAPP12013-20220106-1139.log
2022-01-20 12:41:18 WARNING input file was deleted: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\SPAPP12013-20220106-1209.log
2022-01-20 13:11:18 WARNING input file was deleted: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\SPAPP12013-20220106-1239.log
2022-01-20 13:41:19 WARNING input file was deleted: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\SPAPP12013-20220106-1309.log
2022-01-20 14:11:19 WARNING input file was deleted: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\SPAPP12013-20220106-1339.log
2022-01-20 14:41:19 WARNING input file was deleted: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\SPAPP12013-20220106-1409.log
2022-01-20 15:11:18 WARNING input file was deleted: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\SPAPP12013-20220106-1439.log
2022-01-20 15:41:18 WARNING input file was deleted: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\SPAPP12013-20220106-1509.log
2022-01-20 16:11:18 WARNING input file was deleted: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\SPAPP12013-20220106-1539.log
Version: nxlog-ce-2.11.2190.msi
Contents of nxlog.conf:
#
# Configuration for converting and sending Windows logs
# to AlienVault USM Anywhere.
#
# Version: 0.2.20
# Last modification: 2021-10-15
#
define ROOT C:\Program Files (x86)\nxlog
define OUTPUT_DESTINATION_ADDRESS SYSLOG IP
define OUTPUT_DESTINATION_PORT 514
Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
LogFile %ROOT%\data\nxlog.log
<Extension json>
Module xm_json
</Extension>
<Extension syslog>
Module xm_syslog
</Extension>
<Input internal>
Module im_internal
</Input>
#######################################################################
#### SHAREPOINT-NXLOG #####
#### Uncomment the following lines for SharePoint-NXLOG #####
#### log forwarding #####
#######################################################################
<Extension transform_alienvault_csv_sharepoint>
Module xm_csv
Fields $Timestamp, $Process, $TID, $Area, $Category, $EventID, $Level, $Message, $Correlation
FieldTypes string, string, string, string, string, string, string, string, string
Delimiter \t
</Extension>
<Input SHAREPOINT_IN>
Module im_file
File "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS*-????????-????.log"
<Exec>
# Drop header lines and empty lines
if $raw_event =~ /^(\xEF\xBB\xBF|Timestamp)/ drop();
else
{
$raw_event =~ s/ +(?=\t)//g;
transform_alienvault_csv_sharepoint->parse_csv();
$EventTime = strptime($Timestamp, "%m/%d/%Y %H:%M:%S");
$Hostname = hostname_fqdn();
$SourceName = "SHAREPOINT-NXLOG";
}
</Exec>
</Input>
<Output SHAREPOINT_OUT>
Module om_udp
Host %OUTPUT_DESTINATION_ADDRESS%
Port %OUTPUT_DESTINATION_PORT%
Exec $EventTime = strftime($EventTime, '%Y-%m-%d %H:%M:%S');
Exec $Message = to_json(); to_syslog_bsd();
</Output>
<Route SP_Route>
Path SHAREPOINT_IN => SHAREPOINT_OUT
</Route>
#######################################################################
#### SHAREPOINT-NXLOG #####
#######################################################################
The files are no longer available due to the log retention policy. How do I prevent this error? I'm relatively sure that I'm missing something in the config file. Any help is appreciated.
farrisk01 created
Simple test - reading from a file and writing to another file
Marin created
Hi I'm new to nxlog.
Just wanted to test it and created config that reads from a file and writes to a file.
The input file contains the string This is a test
My config is:
User nxlog
Group nxlog
<Input in>
Module im_file
File "/opt/nxlog/bin/testlog"
<Exec>
if $raw_event =~ /(\w{4})(\s)(\w{2})(\s)(\w{1})(\s)(\w{4})/
{
$f1 = $1;
$f2 = $2;
$f3 = $3;
$f4 = $4;
$f5 = $5;
$f6 = $6;
$f7 = $7;
}
</Exec>
</Input>
<Output out>
Module om_file
File "/opt/nxlog/bin/outest"
</Output>
<Route r>
Path in => out
</Route>
I start nxlog with command nxlog -c myconf and it does not write to the file.
What Am I missing?
Marin created