Getting error when try to config logging

Describe the problem/error/question

Hello n8n Teams, I facing some problem when I ty to config logging in my local instances here are example of my Docker-compose.yml.

  n8n:
    image: docker.n8n.io/n8nio/n8n
    restart: always
    #command: ["start", "--tunnel"]
    ports:
      - "5678:5678"
    labels:
      - traefik.enable=false
      - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
      - traefik.http.routers.n8n.tls=true
      - traefik.http.routers.n8n.entrypoints=web,websecure
      - traefik.http.routers.n8n.tls.certresolver=mytlschallenge
      - traefik.http.middlewares.n8n.headers.SSLRedirect=true
      - traefik.http.middlewares.n8n.headers.STSSeconds=315360000
      - traefik.http.middlewares.n8n.headers.browserXSSFilter=true
      - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n.headers.forceSTSHeader=true
      - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
      - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
      - traefik.http.middlewares.n8n.headers.STSPreload=true
      - traefik.http.routers.n8n.middlewares=n8n@docker
    environment:
      - N8N_HOST=https://98a5-61-19-255-13.ngrok-free.app/
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://98a5-61-19-255-13.ngrok-free.app/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - N8N_LOG_LEVEL=debug
      - N8N_LOG_OUTPUT=console,file
      - N8N_LOG_FILE_LOCATION=/home/n8n/n8n_docker_compsoe/log/n8n.log
      - N8N_LOG_FILE_MAXSIZE=50
      - N8N_LOG_FILE_MAXCOUNT=60
    volumes:
      - n8n_data:/home/node/.n8n

What is the error message (if any)?

And when I try to run docker-compose up it showing this error.

n8n_docker_compsoe-n8n-1 exited with code 1
n8n_docker_compsoe-n8n-1      |     Error: EACCES: permission denied, mkdir '/home/n8n/n8n_docker_compsoe/log'
n8n_docker_compsoe-n8n-1      |     Code: EACCES

Information on your n8n setup

  • n8n version: 1.16.0
  • Database (default: SQLite):default
  • n8n EXECUTIONS_PROCESS setting (default: own, main):default
  • Running n8n via (Docker, npm, n8n cloud, desktop app):Docker-compose
  • Operating system:Linux

Hey @Winniepoom,

/home/n8n/ won’t exist in your n8n installation and the node user won’t be able to create it as it won’t have permission to do it. I would recommend using a bind volume and pointing the log location to that.

So if your linux user was called n8n I would do something like…

mkdir /home/n8n/logs

Then add that to your container with

volumes:
  - n8n_data:/home/node/.n8n
  - /home/n8n/logs:/logs

Then set the N8N_LOG_FILE_LOCACATION to /logs/n8n.log and see if that works.

Hey It work, I can run docker-compose up, But I can’t see any log file in logs directory that suppose to be n8n.log it just empty.

    environment:
      - N8N_HOST=https://98a5-61-19-255-13.ngrok-free.app/
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://98a5-61-19-255-13.ngrok-free.app/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - N8N_LOG_LEVEL=debug
      - N8N_LOG_OUTPUT=console,file
      - N8N_LOG_FILE_LOCATION=/logs/n8n.log
      - N8N_LOG_FILE_MAXSIZE=50
      - N8N_LOG_FILE_MAXCOUNT=60
    volumes:
      - n8n_data:/home/node/.n8n
      - /home/n8n/logs:/logs
volumes:
  traefik_data:
    external: true
  n8n_data:
    external: true

Is there any error in the console log?

As far as I saw there is no error showed. but here is a console log file incase I miss some detail.

root@n8n:/home/n8n/n8n_docker_compsoe# docker-compose up
Creating network "n8n_docker_compsoe_default" with the default driver
Creating n8n_docker_compsoe_n8n_1     ... done
Creating n8n_docker_compsoe_traefik_1 ... done
Attaching to n8n_docker_compsoe_traefik_1, n8n_docker_compsoe_n8n_1
traefik_1  | time="2023-12-12T19:27:56Z" level=info msg="Configuration loaded from flags."
n8n_1      | 2023-12-12T19:28:02.504Z | info     | Initializing n8n process "{ file: 'start.js', function: 'init' }"
n8n_1      | 2023-12-12T19:28:03.001Z | debug    | Lazy Loading credentials and nodes from n8n-nodes-base "{\n  credentials: 348,\n  nodes: 449,\n  file: 'LoggerProxy.js',\n  function: 'exports.debug'\n}"
n8n_1      | 2023-12-12T19:28:03.021Z | debug    | Can't enable lazy-loading "{ file: 'LoggerProxy.js', function: 'exports.debug' }"
n8n_1      | 2023-12-12T19:28:03.872Z | debug    | No codex available for: GoogleSheetsTrigger.node.js "{ file: 'LoggerProxy.js', function: 'exports.debug' }"
n8n_1      | 2023-12-12T19:28:03.874Z | debug    | Loaded all credentials and nodes from n8n-nodes-google-sheets-trigger "{\n  credentials: 0,\n  nodes: 1,\n  file: 'LoggerProxy.js',\n  function: 'exports.debug'\n}"
n8n_1      | 2023-12-12T19:28:03.877Z | debug    | Can't enable lazy-loading "{ file: 'LoggerProxy.js', function: 'exports.debug' }"
n8n_1      | 2023-12-12T19:28:03.915Z | debug    | No codex available for: Zabbix.node.js "{ file: 'LoggerProxy.js', function: 'exports.debug' }"
n8n_1      | 2023-12-12T19:28:03.917Z | debug    | Loaded all credentials and nodes from @digital-boss/n8n-nodes-zabbix "{\n  credentials: 2,\n  nodes: 1,\n  file: 'LoggerProxy.js',\n  function: 'exports.debug'\n}"
n8n_1      | n8n ready on 0.0.0.0, port 5678
n8n_1      | 2023-12-12T19:28:04.426Z | debug    | [license] initializing for deviceFingerprint 63b0410e2192bcfedd6c2e67eb3b6b4557bf40fd34a40b41464101688fab71dc "{ file: 'LicenseManager.js', function: 'log' }"
n8n_1      | 2023-12-12T19:28:04.452Z | debug    | [license] attempting license renewal "{ file: 'LicenseManager.js', function: 'log' }"
n8n_1      | 2023-12-12T19:28:04.454Z | debug    | Orchestration init complete "{ file: 'start.js', function: 'init' }"
n8n_1      | 2023-12-12T19:28:04.481Z | debug    | Binary data service init complete "{ file: 'start.js', function: 'init' }"
n8n_1      | 2023-12-12T19:28:04.482Z | debug    | External hooks init complete "{ file: 'start.js', function: 'init' }"
n8n_1      | 2023-12-12T19:28:04.486Z | debug    | External secrets init complete "{ file: 'start.js', function: 'init' }"
n8n_1      | 2023-12-12T19:28:04.487Z | debug    | Workflow history init complete "{ file: 'start.js', function: 'init' }"
n8n_1      | 2023-12-12T19:28:05.589Z | debug    | Wait tracker querying database for waiting executions "{ file: 'WaitTracker.js', function: 'getWaitingExecutions' }"
n8n_1      | 2023-12-12T19:28:08.768Z | debug    | Initializing event bus... "{ file: 'MessageEventBus.js', function: 'initialize' }"
n8n_1      | 2023-12-12T19:28:08.773Z | debug    | Initializing event writer "{ file: 'MessageEventBus.js', function: 'initialize' }"
n8n_1      | 2023-12-12T19:28:08.783Z | debug    | Checking for unsent event messages "{ file: 'MessageEventBus.js', function: 'initialize' }"
n8n_1      | 2023-12-12T19:28:11.750Z | debug    | Start logging into /home/node/.n8n/n8nEventLog.log  "{ file: 'MessageEventBus.js', function: 'initialize' }"
n8n_1      | 2023-12-12T19:28:11.766Z | debug    | MessageEventBus initialized "{ file: 'MessageEventBus.js', function: 'initialize' }"
n8n_1      | Version: 1.16.0
n8n_1      | 2023-12-12T19:28:11.768Z | debug    | Server ID: main-BzoJSpvMfpQeoD8g "{ file: 'Server.js', function: 'start' }"
n8n_1      | 2023-12-12T19:28:11.774Z | debug    | Setting soft-deletion interval at every 60.00 min (pruning cycle) "{ file: 'pruning.service.js', function: 'setSoftDeletionInterval' }"
n8n_1      | 2023-12-12T19:28:11.775Z | debug    | Scheduling hard-deletion for next 15.00 min (pruning cycle) "{ file: 'pruning.service.js', function: 'scheduleHardDeletion' }"
n8n_1      | 2023-12-12T19:28:11.795Z [Rudder] debug: in flush
n8n_1      | 2023-12-12T19:28:11.795Z [Rudder] debug: batch size is 1
n8n_1      | 2023-12-12T19:28:11.802Z [Rudder] debug: no existing flush timer, creating new one
n8n_1      | 2023-12-12T19:28:11.945Z | info     |  ================================ "{ file: 'ActiveWorkflowRunner.js', function: 'addActiveWorkflows' }"
n8n_1      | 2023-12-12T19:28:11.946Z | info     |    Start Active Workflows: "{ file: 'ActiveWorkflowRunner.js', function: 'addActiveWorkflows' }"
n8n_1      | 2023-12-12T19:28:11.947Z | info     |  ================================ "{ file: 'ActiveWorkflowRunner.js', function: 'addActiveWorkflows' }"
n8n_1      | 2023-12-12T19:28:11.947Z | info     |    - "Budibase - Slack" (ID: RTgB8FukVDrXqsQI) "{ file: 'ActiveWorkflowRunner.js', function: 'addActiveWorkflows' }"
n8n_1      | 2023-12-12T19:28:11.948Z | debug    | Initializing active workflow "Budibase - Slack" (ID: RTgB8FukVDrXqsQI) (startup) "{\n  workflowName: 'Budibase - Slack',\n  workflowId: 'RTgB8FukVDrXqsQI',\n  file: 'ActiveWorkflowRunner.js',\n  function: 'addActiveWorkflows'\n}"
n8n_1      | 2023-12-12T19:28:12.090Z | debug    | ============ "{ file: 'ActiveWorkflowRunner.js', function: 'add' }"
n8n_1      | 2023-12-12T19:28:12.091Z | debug    | Adding webhooks for workflow ""Budibase - Slack" (ID: RTgB8FukVDrXqsQI)" "{ file: 'ActiveWorkflowRunner.js', function: 'add' }"
n8n_1      | 2023-12-12T19:28:12.091Z | debug    | ============ "{ file: 'ActiveWorkflowRunner.js', function: 'add' }"
n8n_1      | 2023-12-12T19:28:12.223Z | debug    | ============ "{ file: 'ActiveWorkflowRunner.js', function: 'add' }"
n8n_1      | 2023-12-12T19:28:12.224Z | debug    | Adding triggers and pollers for workflow ""Budibase - Slack" (ID: RTgB8FukVDrXqsQI)" "{ file: 'ActiveWorkflowRunner.js', function: 'add' }"
n8n_1      | 2023-12-12T19:28:12.224Z | debug    | ============ "{ file: 'ActiveWorkflowRunner.js', function: 'add' }"
n8n_1      | 2023-12-12T19:28:12.241Z | verbose  | Successfully started workflow "Budibase - Slack" (ID: RTgB8FukVDrXqsQI) "{\n  workflowName: 'Budibase - Slack',\n  workflowId: 'RTgB8FukVDrXqsQI',\n  file: 'ActiveWorkflowRunner.js',\n  function: 'addActiveWorkflows'\n}"
n8n_1      | 2023-12-12T19:28:12.241Z | info     |      => Started "{ file: 'ActiveWorkflowRunner.js', function: 'addActiveWorkflows' }"
n8n_1      | 2023-12-12T19:28:12.242Z | info     |    - "Test 2 Way Sync" (ID: fGpZJmubhuMYDnya) "{ file: 'ActiveWorkflowRunner.js', function: 'addActiveWorkflows' }"
n8n_1      | 2023-12-12T19:28:12.243Z | debug    | Initializing active workflow "Test 2 Way Sync" (ID: fGpZJmubhuMYDnya) (startup) "{\n  workflowName: 'Test 2 Way Sync',\n  workflowId: 'fGpZJmubhuMYDnya',\n  file: 'ActiveWorkflowRunner.js',\n  function: 'addActiveWorkflows'\n}"
n8n_1      | 2023-12-12T19:28:13.094Z | debug    | ============ "{ file: 'ActiveWorkflowRunner.js', function: 'add' }"
n8n_1      | 2023-12-12T19:28:13.095Z | debug    | Adding webhooks for workflow ""Test 2 Way Sync" (ID: fGpZJmubhuMYDnya)" "{ file: 'ActiveWorkflowRunner.js', function: 'add' }"
n8n_1      | 2023-12-12T19:28:13.096Z | debug    | ============ "{ file: 'ActiveWorkflowRunner.js', function: 'add' }"
n8n_1      | 2023-12-12T19:28:13.125Z | debug    | ============ "{ file: 'ActiveWorkflowRunner.js', function: 'add' }"
n8n_1      | 2023-12-12T19:28:13.126Z | debug    | Adding triggers and pollers for workflow ""Test 2 Way Sync" (ID: fGpZJmubhuMYDnya)" "{ file: 'ActiveWorkflowRunner.js', function: 'add' }"
n8n_1      | 2023-12-12T19:28:13.127Z | debug    | ============ "{ file: 'ActiveWorkflowRunner.js', function: 'add' }"
n8n_1      | 2023-12-12T19:28:13.137Z | verbose  | Workflow "Test 2 Way Sync" (ID: fGpZJmubhuMYDnya) activated "{\n  workflowId: 'fGpZJmubhuMYDnya',\n  workflowName: 'Test 2 Way Sync',\n  file: 'ActiveWorkflowRunner.js',\n  function: 'addTriggersAndPollers'\n}"
n8n_1      | 2023-12-12T19:28:13.173Z | verbose  | Successfully started workflow "Test 2 Way Sync" (ID: fGpZJmubhuMYDnya) "{\n  workflowName: 'Test 2 Way Sync',\n  workflowId: 'fGpZJmubhuMYDnya',\n  file: 'ActiveWorkflowRunner.js',\n  function: 'addActiveWorkflows'\n}"
n8n_1      | 2023-12-12T19:28:13.173Z | info     |      => Started "{ file: 'ActiveWorkflowRunner.js', function: 'addActiveWorkflows' }"
n8n_1      | 2023-12-12T19:28:13.174Z | verbose  | Finished activating workflows (startup) "{ file: 'ActiveWorkflowRunner.js', function: 'addActiveWorkflows' }"
n8n_1      |
n8n_1      | Editor is now accessible via:
n8n_1      | https://https://98a5-61-19-255-13.ngrok-free.app/:5678/
n8n_1      | 

That looks to be ok, I will do a quick test on my local install and let you know what I find.

Hey @Winniepoom,

So it looks like it was a permission error, To fix it you will need to set the owner of the folder inside the container to the node user. To do this assuming you are using the path /logs you can run…

docker exec -it -u root n8n_1 sh -c 'chown node:node /logs'

Once this is done you can restart the container and you should start to see the logs.

Yes it working it can store a logging file now. Thank you Jon.

1 Like

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