# General logging questions

**URL:** <https://community.n8n.io/t/general-logging-questions/14337>\
**Category:** Questions\
**Tags:** core, cli\
**Created:** [May 26, 2022, 3:55pm UTC](https://community.n8n.io/t/general-logging-questions/14337 "2022-05-26T15:55:08Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![johna](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@johna](https://community.n8n.io/u/johna)\
**Post date:** [May 26, 2022, 3:55pm UTC](https://community.n8n.io/t/general-logging-questions/14337/1 "2022-05-26T15:55:09Z")

</div>

Hi there, we’re evaluating n8n to see if it is the right fit for our use case. We’ve taken a look at [Logging - n8n Documentation](https://docs.n8n.io/hosting/logging/) and have a few questions:

1. Are logs roll your own or are there some templates/examples that we can leverage to get started?
2. Are there any examples of logs and code that generates logs?
3. Can workflow template definition JSON be accessed programmatically? It looks like there’s a way to do this [through the CLI](https://docs.n8n.io/reference/cli-commands/#workflows):  
n8n export:workflow --all
4. Is there a way to log the workflow definition JSON when a workflow kicks off?
5. Is there a way to programmatically access human readable names for node types? For example, if I have a node of type n8n-nodes-base.httpRequest, can I programmatically get the human readable name of HTTP Request?
6. Is there a way to programmatically access user data?

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [May 27, 2022, 9:49am UTC](https://community.n8n.io/t/general-logging-questions/14337/2 "2022-05-27T09:49:26Z")

</div>

Hi @johna, welcome to the community!

Quite a bit to unpack here 🙂

1. _Are logs roll your own or are there some templates/examples that we can leverage to get started?_  
Yes, by default only the last 100 log files (each file containing 16 MB of data) are kept. You can adjust `N8N_LOG_FILE_MAXSIZE` and `N8N_LOG_FILE_MAXCOUNT` to configure this behaviour.
2. _Are there any examples of logs and code that generates logs?_  
No, but you could simply spin up a test instance using docker by running something like `docker run -it --rm --name n8nlogging -e N8N_LOG_LEVEL=debug -p 5678:5678 n8nio/n8n:0.178.2` and take a look at the real-world output. Here is the debug output from me playing around with a simple webhook workflow just now:

```auto
2022-05-27T09:52:06.465Z | debug | Received webhoook "GET" for path "30c1ba65-af24-42d4-aae9-35fae3631cf3" {"file":"ActiveWorkflowRunner.js","function":"executeWebhook"}
2022-05-27T09:52:06.495Z | verbose | Started execution of workflow "Example" from webhook with execution ID 3 {"executionId":"3","file":"WebhookHelpers.js","function":"executeWebhook"}
2022-05-27T09:52:08.191Z | debug | Received child process message of type start for execution ID 3. {"executionId":"3","file":"WorkflowRunner.js"}
2022-05-27T09:52:08.216Z | verbose | Initializing n8n sub-process {"pid":41,"workflowId":1,"file":"WorkflowRunnerProcess.js","function":"runWorkflow"}
2022-05-27T09:52:08.283Z | verbose | Workflow execution started {"workflowId":1,"file":"WorkflowExecute.js","function":"processRunExecutionData"}
2022-05-27T09:52:08.288Z | debug | Received child process message of type processHook for execution ID 3. {"executionId":"3","file":"WorkflowRunner.js"}
2022-05-27T09:52:08.288Z | debug | Executing hook (hookFunctionsPush) {"executionId":"3","workflowId":1,"file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteBefore"}
2022-05-27T09:52:08.288Z | debug | Start processing node "Webhook" {"node":"Webhook","workflowId":1,"file":"WorkflowExecute.js"}
2022-05-27T09:52:08.289Z | debug | Received child process message of type processHook for execution ID 3. {"executionId":"3","file":"WorkflowRunner.js"}
2022-05-27T09:52:08.289Z | debug | Running node "Webhook" started {"node":"Webhook","workflowId":1,"file":"WorkflowExecute.js"}
2022-05-27T09:52:08.291Z | debug | Running node "Webhook" finished successfully {"node":"Webhook","workflowId":1,"file":"WorkflowExecute.js"}
2022-05-27T09:52:08.292Z | debug | Received child process message of type processHook for execution ID 3. {"executionId":"3","file":"WorkflowRunner.js"}
2022-05-27T09:52:08.293Z | debug | Start processing node "HTTP Request" {"node":"HTTP Request","workflowId":1,"file":"WorkflowExecute.js"}
2022-05-27T09:52:08.294Z | debug | Received child process message of type processHook for execution ID 3. {"executionId":"3","file":"WorkflowRunner.js"}
2022-05-27T09:52:08.294Z | debug | Running node "HTTP Request" started {"node":"HTTP Request","workflowId":1,"file":"WorkflowExecute.js"}
2022-05-27T09:52:08.298Z | debug | Proxying request to axios {"file":"NodeExecuteFunctions.js","function":"proxyRequestToAxios"}
2022-05-27T09:52:08.428Z | debug | Running node "HTTP Request" finished successfully {"node":"HTTP Request","workflowId":1,"file":"WorkflowExecute.js"}
2022-05-27T09:52:08.429Z | debug | Start processing node "Item Lists" {"node":"Item Lists","workflowId":1,"file":"WorkflowExecute.js"}
2022-05-27T09:52:08.429Z | debug | Received child process message of type processHook for execution ID 3. {"executionId":"3","file":"WorkflowRunner.js"}
2022-05-27T09:52:08.429Z | debug | Running node "Item Lists" started {"node":"Item Lists","workflowId":1,"file":"WorkflowExecute.js"}
2022-05-27T09:52:08.430Z | debug | Received child process message of type processHook for execution ID 3. {"executionId":"3","file":"WorkflowRunner.js"}
2022-05-27T09:52:08.432Z | debug | Running node "Item Lists" finished successfully {"node":"Item Lists","workflowId":1,"file":"WorkflowExecute.js"}
2022-05-27T09:52:08.433Z | debug | Received child process message of type processHook for execution ID 3. {"executionId":"3","file":"WorkflowRunner.js"}
2022-05-27T09:52:08.433Z | verbose | Workflow execution finished successfully {"workflowId":1,"file":"WorkflowExecute.js","function":"processSuccessExecution"}
2022-05-27T09:52:08.434Z | debug | Received child process message of type processHook for execution ID 3. {"executionId":"3","file":"WorkflowRunner.js"}
2022-05-27T09:52:08.434Z | debug | Executing hook (hookFunctionsSave) {"executionId":"3","workflowId":1,"file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteAfter"}
2022-05-27T09:52:08.435Z | debug | Save execution data to database for execution ID 3 {"executionId":"3","workflowId":1,"finished":true,"stoppedAt":"2022-05-27T09:52:08.433Z","file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteAfter"}
2022-05-27T09:52:08.437Z | debug | Received child process message of type end for execution ID 3. {"executionId":"3","file":"WorkflowRunner.js"}
2022-05-27T09:52:08.450Z | debug | Executing hook (hookFunctionsPush) {"executionId":"3","workflowId":1,"file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteAfter"}

```

1. _Can workflow template definition JSON be accessed programmatically? It looks like there’s a way to do this [through the CLI](https://docs.n8n.io/reference/cli-commands/#workflows):_  
Yes, that would be one possible way. We are also working on an official REST API through which this will be possible (and you can also use the UI API for this as [shown here](http://community.n8n.io/t/credential-unauthorized/12229/3), though this is undocumented + unsupported).
2. _Is there a way to log the workflow definition JSON when a workflow kicks off?_  
The workflow definition isn’t part of the logs, but it’s stored with the execution data (in the `workflowData` field of the `execution_entity` table, the full table structure is [documented here](https://docs.n8n.io/hosting/databases/structure/#execution-entity)) if you [choose](https://docs.n8n.io/hosting/scaling/execution-data/) to save such data.
3. _Is there a way to programmatically access human readable names for node types? For example, if I have a node of type n8n-nodes-base.httpRequest, can I programmatically get the human readable name of HTTP Request?_  
There’s no in-platform way to resolve the human-readable name I am aware of unfortunately. The given name of a node would be part of the aforementioned workflow JSON though.
4. _Is there a way to programmatically access user data?_  
Are you referring to the user credentials stored in n8n? These could be read via the CLI ([a command](https://docs.n8n.io/reference/cli-commands/#credentials) like `n8n export:credentials --all --decrypted` would do the job). If you’re looking for [n8n users](https://docs.n8n.io/hosting/user-management/), these would be stored in the `users` table of your n8n database.

---

<div class="post-metadata">

**Author:** ![alexpti4ka](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/alexpti4ka/32/14893_2.png) [@alexpti4ka](https://community.n8n.io/u/alexpti4ka)\
**Post date:** [November 29, 2022, 2:08pm UTC](https://community.n8n.io/t/general-logging-questions/14337/3 "2022-11-29T14:08:44Z")

</div>

> [@MutedJam](#):
>
> `Started execution of workflow "Example" from webhook with execution ID 3 {"executionId":"3","file":"WebhookHelpers.js","function":"executeWebhook"}`

Hello! Wondering if there’s a way I can search through log files for specific user or transaction id? I’m debugging my working workflow with a lot of entities and it’s almost impossible to search through logs by timestamp only.  
Thank you in advance!

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [November 30, 2022, 2:58pm UTC](https://community.n8n.io/t/general-logging-questions/14337/4 "2022-11-30T14:58:59Z")

</div>

Hi @alexpti4ka, there is currently no way built into n8n to search through the actual execution data.

You could, however, query the `execution_entity` table if you are using a suitable database. The simplest possible (but rather expensive) query I could think of would be something like this:

```sql
SELECT
  "workflowId",
  "id" AS "executionId"
FROM
  execution_entity
WHERE
  "workflowData"::text ILIKE '%alexpti4ka%'
  AND "workflowId" IS NOT NULL;

```

That is assuming you are using Postgres and want to search for `alexpti4ka`. It also works right in n8n if you want to automate such lookups:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/7/e/7e30ccd89769e665d991c187fc0dd3d38397221c.png)

---

<div class="post-metadata">

**Author:** ![alexpti4ka](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/alexpti4ka/32/14893_2.png) [@alexpti4ka](https://community.n8n.io/u/alexpti4ka)\
**Post date:** [December 1, 2022, 10:22am UTC](https://community.n8n.io/t/general-logging-questions/14337/5 "2022-12-01T10:22:09Z")

</div>

Thanks a lot, I guess this can do the job.  
I just wonder how I can set up a proper Postgres DB?  
I’m running a default instance from [your manual](https://docs.n8n.io/hosting/server-setups/docker-compose/).

As far as I understand, this step defines my db path

```auto
mkdir /root/n8n/

```

However I see no db inside this folder, just a **letsencrypt** file.

I’ve also inspected my _.env_ and _docker-compose.yml_ files and saw neither db mentions nor credentials to access it. Could you please explain how I can access n8n’s db to run this query?

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [December 1, 2022, 10:38am UTC](https://community.n8n.io/t/general-logging-questions/14337/6 "2022-12-01T10:38:37Z")

</div>

By default n8n would use an SQLite database. Any other database connection would have to be configured through [environment variables](https://docs.n8n.io/hosting/environment-variables/#database).

Migrating from one database to another is a bit of effort though. It would require you to export your workflows and credentials from your n8n instance connected to the old database and then import it again once n8n is up and running connected to the new database. Our [CLI](https://docs.n8n.io/reference/cli-commands/) can help with that if that’s too much to transfer manually.

---

<div class="post-metadata">

**Author:** ![alexpti4ka](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/alexpti4ka/32/14893_2.png) [@alexpti4ka](https://community.n8n.io/u/alexpti4ka)\
**Post date:** [December 1, 2022, 12:19pm UTC](https://community.n8n.io/t/general-logging-questions/14337/7 "2022-12-01T12:19:24Z")

</div>

I’ll check that up, thanks.  
Maybe there’s a way I can send an execution id to my database at the end of the workflow?  
Without modifying default db I mean.  
Something like {{get[executionId]}} code?

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [December 1, 2022, 12:20pm UTC](https://community.n8n.io/t/general-logging-questions/14337/8 "2022-12-01T12:20:35Z")

</div>

Your database would hold the execution ID by default, so you wouldn’t need to manually store it in there. The `id` field in the `execution_entity` is the execution ID you can see in the frontend.

---

<div class="post-metadata">

**Author:** ![alexpti4ka](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/alexpti4ka/32/14893_2.png) [@alexpti4ka](https://community.n8n.io/u/alexpti4ka)\
**Post date:** [December 1, 2022, 2:52pm UTC](https://community.n8n.io/t/general-logging-questions/14337/9 "2022-12-01T14:52:49Z")

</div>

Oh I see! But what are the credentials for getting inside the default SQLite db?

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [December 1, 2022, 2:59pm UTC](https://community.n8n.io/t/general-logging-questions/14337/10 "2022-12-01T14:59:11Z")

</div>

The SQLite database wouldn’t require credentials. Using a suitable you can open the database.sqlite file which usually lives in the hidden `.n8n` folder of your home directory.

This is how it would look like in [DB Browser](https://sqlitebrowser.org/):

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/3/1/31af4caa1f18bead88ca01ad85aae12ef60a8947.png)

---

<div class="post-metadata">

**Author:** ![alexpti4ka](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/alexpti4ka/32/14893_2.png) [@alexpti4ka](https://community.n8n.io/u/alexpti4ka)\
**Post date:** [December 2, 2022, 7:44am UTC](https://community.n8n.io/t/general-logging-questions/14337/11 "2022-12-02T07:44:49Z")

</div>

Thanks, I checked that up, looks good for local instance.  
But when I tried to run sqlite3 at my Ubuntu server it sees no content inside database.sqlite

 ![Screenshot 2022-12-02 at 14.43.07](https://europe1.discourse-cdn.com/n8n/original/3X/4/0/4016388b626aaf6382bb9bf381ad1158d9661cb4.png)

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [December 2, 2022, 9:00am UTC](https://community.n8n.io/t/general-logging-questions/14337/12 "2022-12-02T09:00:32Z")

</div>

Hey @alexpti4ka,

There is no config file in that folder either are you sure that is the correct path and that n8n is configured to use it?

I would expect to see… database.sqlite, config and maybe a folder called binaryData.

---

<div class="post-metadata">

**Author:** ![alexpti4ka](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/alexpti4ka/32/14893_2.png) [@alexpti4ka](https://community.n8n.io/u/alexpti4ka)\
**Post date:** [December 18, 2022, 8:27am UTC](https://community.n8n.io/t/general-logging-questions/14337/13 "2022-12-18T08:27:59Z")

</div>

Hey! I’m afraid there’s nothing like you described. Maybe those files are somehow hidden or I’m searching the wrong place?

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [December 19, 2022, 6:49pm UTC](https://community.n8n.io/t/general-logging-questions/14337/14 "2022-12-19T18:49:58Z")

</div>

That could be it, I can see a docker compose file there is that for n8n?

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [March 19, 2023, 6:50pm UTC](https://community.n8n.io/t/general-logging-questions/14337/15 "2023-03-19T18:50:10Z")

</div>

Closed on March 19, 2023, 6:50pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
