Software⏱️ 3 min read📅 2026-06-19

How to Fix: nxlog to_json output giving error on service start

NXLog configuration issue with to_json() function causing error on service start.

Quick Answer: Check the NXLog documentation for the correct usage of the to_json() function and ensure that it is properly configured in your nxlog.conf file.

The nxlog server is unable to parse the JSON output due to an error in the configuration file. This issue affects anyone who has set up nxlog and is experiencing this problem.

This error can be frustrating as it prevents the system from functioning correctly, and resolving it requires careful examination of the configuration file.

💡 Why You Are Getting This Error

  • The first main reason for this error is the incorrect use of the 'to_json()' function in the Exec block. The 'to_json()' function is not a valid procedure in nxlog, and its usage can cause the system to fail.
  • Another possible reason for this error is that the conversion from one charset to another in the Exec block is causing issues. In this case, the conversion from windows-1252 to utf-8 is incorrect.

✅ Best Solutions to Fix It

Correcting the configuration file

  1. Step 1: Open the nxlog configuration file and locate the input section with the in_snare input.
  2. Step 2: Remove the 'to_json()' function from the Exec block, as it is not a valid procedure in nxlog. Instead, use the 'convert_fields' function to convert the fields to utf-8.
  3. Step 3: Save the changes to the configuration file and restart the nxlog service.

Correcting charset conversion

  1. Step 1: Open the nxlog configuration file and locate the input section with the in_snare input.
  2. Step 2: Check if the conversion from windows-1252 to utf-8 is correct. If not, update the conversion function to use the correct charsets.
  3. Step 3: Save the changes to the configuration file and restart the nxlog service.

🎯 Final Words

By following these steps, you should be able to resolve the error and get your nxlog server up and running correctly. Remember to carefully examine your configuration file and ensure that all conversions are correct.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions