I have got my two smtp servers sending their logs to Graylog via nxlog but something about he parsing of the data goes wrong and either the log isn’t processed or the fields are all jumbled.
Any help on what may be wrong would be great. Please see my logs/confs below.
Thanks.
2017-03-28 11:17:40 INFO nxlog-ce-2.9.1716 started
2017-03-28 11:17:52 ERROR if-else failed at line 44, character 436 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 44, character 224 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 8 in input 'e SMTPSVC1 WF15 25 - 250-mailserver.cmp.livemail.co.uk 33 31'
2017-03-28 11:20:40 ERROR if-else failed at line 44, character 436 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 44, character 224 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 8 in input ''
2017-03-28 11:21:11 ERROR if-else failed at line 44, character 436 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 44, character 224 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 8 in input ''
2017-03-28 11:22:10 ERROR if-else failed at line 44, character 436 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 44, character 224 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 6 in input ''
2017-03-28 11:22:21 ERROR if-else failed at line 44, character 436 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 44, character 224 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 5 in input ''
2017-03-28 11:23:35 ERROR if-else failed at line 44, character 436 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 44, character 224 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 3 in input ''
2017-03-28 11:24:59 ERROR if-else failed at line 44, character 436 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 44, character 224 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 7 in input ''
2017-03-28 11:25:27 ERROR if-else failed at line 44, character 436 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 44, character 224 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 5 in input ''
2017-03-28 11:26:49 ERROR if-else failed at line 44, character 436 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 44, character 224 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 3 in input ''
Yes I did but without much luck, the main person that was helping me ultimately just suggested I pay for commercial support but not really what i am looking for. I will try refreshing the thread and get some more from them.
If anyone here has any input from using nxlog and graylog I would really appreciate the input.
To me it seems that nxlog complains that you require log file to have 11 fields on each line, but the log source sends log lines that have 3 to 8 lines only. So I would look at the log file at the log source and check if it really has the format you expect it to have.
Your module comment says it is the format used by IIS but you use it to read SMTP logs. So I would suspect that.
And yet another question. Why do you parse to json before sending with GELF? If you just want to store log in Graylog, you do not need to parse to json; GELF input works as is.
There is no need to replace it with anything. The message is automatically filled. You make a format conversion from the original log line to a JSON formatted log line with that statement. If you remove the format conversion, the $message field will contain the original log line.
2017-04-03 11:52:22 ERROR module 'smtp' has configuration errors, not adding to route 'iis-to-graylog' at C:\Program Files (x86)\nxlog\conf\nxlog.conf:69
2017-04-03 11:52:22 ERROR route iis-to-graylog is not functional without input modules, ignored at C:\Program Files (x86)\nxlog\conf\nxlog.conf:69
2017-04-03 11:52:22 WARNING not starting unused module smtp
2017-04-03 11:52:22 WARNING not starting unused module test
2017-04-03 11:52:22 INFO nxlog-ce-2.9.1716 started
2017-04-03 12:02:18 ERROR if-else failed at line 43, character 385 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 43, character 224 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 8 in input ''
2017-04-03 12:02:26 ERROR if-else failed at line 43, character 385 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 43, character 224 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 3 in input ''
2017-04-03 12:02:32 ERROR if-else failed at line 43, character 385 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 43, character 224 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 2 in input ''
2017-04-03 12:02:43 ERROR if-else failed at line 43, character 385 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 43, character 224 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 8 in input ''
2017-04-03 12:02:49 ERROR if-else failed at line 43, character 385 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 43, character 224 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 7 in input ''
To me it seems this if-else construct is not working for some reason and nxlog actually gives also the commented lines to parse_csv. If you try something like this, will it work?
Also, you could add some debug command to the first line, in addition to the drop(), to see if the condition is triggered at all.
Btw., after removing the to_json, do the log lines look OK in Graylog? If so, then you should also be able to remove a JSON extractor from the input, if you have one, as the GELF input has automatically the fields extracted by nxlog.
With that code added it does run but i still get this in the nxlog log
2017-04-03 12:58:01 ERROR if-else failed at line 41, character 116 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 41, character 47 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Not enough fields in CSV input, expected 11, got 8 in input 'onnectionCommand SMTPSVC1 WF9 25 QUIT - 4 1563