N8N logging levels and Output

Hi there!

we’re evaluating n8n to see if it is the right fit for our use case in validating the errors. We’ve taken a look at Logging - n8n Documentation and have a few questions:

Our n8n worker logs are pushed to our Internal alert management system/tool and there we are trying to setup monitorings as and when a workflow gets failed during its execution. Upon trying to setup the monitoring via our internal tool, we see a requirement to update/rename the fields as they are reserved keyworks in our Internal tool.

Eg : We wanted to rename the JSON fields like “Error”,“Message” etc…

Sample output log:

{“level”:“verbose”,“message”:“Workflow execution finished with error”,“metadata”:{“error”:{“cause”:{“message”:“404 - “””,“name”:“Error”,“stack”:“Error: Request failed with status code 404\n at createError (/usr/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/usr/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/usr/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11)\n at IncomingMessage.emit (events.js:412:35)\n at IncomingMessage.emit (domain.js:475:12)\n at endReadableNT (internal/streams/readable.js:1333:12)\n at processTicksAndRejections (internal/process/task_queues.js:82:21)”},“description”:“404 - “””,“httpCode”:“404”,“message”:“The resource you are requesting could not be found”,“name”:“NodeApiError”,“node”:{“credentials”:{“freshserviceApi”:{“id”:“165”,“name”:“noc-alerts cleanup”}},“name”:“GET ticket”,“parameters”:{“operation”:“get”,“resource”:“ticket”,“ticketId”:"={{$json[“body”][“freshdesk_webhook”][“ticket_id”].split()[1]}}"},“position”:[-940,-40],“type”:“n8n-nodes-base.freshservice”,“typeVersion”:1},“stack”:"NodeApiError: The resource you are requesting could not be found\n at Object.freshserviceApiRequest (/usr/lib/node_modules/n8n/node_modules/n8n-nodes-

Questions :

  1. Is it really possible to rename these fields ?
  2. Currently, we use “Verbose” as the log level, does any other log level options gives better log output with json values ?

Hey @sree_subin,

Technically… Yes you could rename those fields but it is not an out of the box feature so you would need to directly edit the code in n8n and maintain your own images to deploy based on your code change.

Verbose is probably the “best” option for output but have you thought about using an error workflow? That would let you call your own workflow if there is an issue and you can then use any nodes you want including writing your own logs or making an HTTP post if your tool supports that.

Hi @Jon

Much thanks for the suggestion. Do you have any idea on the file/path where we could get this fields updated/renamed ?

We tried searching for this stuff, but was helpless.

Thanks in advance !

Hey @sree_subin,

If you wanted to take that route I would probably start with the Logger class here: n8n/Logger.ts at master · n8n-io/n8n · GitHub although it won’t be as easy as you may be expecting.

Out of interesting what is the tool you are using?