https://cerbos.dev logo
#help
Title
# help
v

Vijey Deepan

01/27/2023, 8:24 AM
cerbos: error: failed to create audit log: failed to create backend: failed to create logger: open sink "/auditlogs/audit.log": open /auditlogs/audit.log: no such file or directory
Copy code
audit:
  enabled: true 
  accessLogsEnabled: true 
  decisionLogsEnabled: true 
  backend: file
  file:
    path: /auditlogs/audit.log
this is the cerbos configuration am trying to use
but am getting the error as above
basically am trying to capture the logs in a file or a db
audit:
enabled: true
accessLogsEnabled: true
decisionLogsEnabled: true
backend: file
file:
path: stdout
when i specify the path as stdout, i was able to get the output in docker logs
am doing something wrong from my side. TIA
c

Charith (Cerbos)

01/27/2023, 9:05 AM
If this is inside a container and you're trying to write to the container file system, the directory must exist first. You should mount a volume at that path by using the
-v
argument to Docker. Something like:
Copy code
docker run -it -v $(pwd):/auditlogs <http://ghcr.io/cerbos/cerbos:latest|ghcr.io/cerbos/cerbos:latest>
v

Vijey Deepan

01/27/2023, 9:06 AM
thank you 🙌
will try this
cerbos:
container_name: cerbos
image: <http://ghcr.io/cerbos/cerbos:latest|ghcr.io/cerbos/cerbos:latest>
restart: always
command: ["server", "--config=/config/conf.yaml", "--log-level=warn"]
volumes:
- ./config:/config
- ${PWD}/auditlogs:/auditlogs/audit.log
depends_on:
- database
ports:
- 3592:3592
- 3593:3593
networks:
- intranet
audit:
enabled: true
accessLogsEnabled: true
decisionLogsEnabled: true
backend: file
file:
path: /auditlogs/audit.log
configured like this still same error
c

Charith (Cerbos)

01/27/2023, 9:17 AM
Try with this config:
Copy code
cerbos:
    container_name: cerbos
    image: <http://ghcr.io/cerbos/cerbos:latest|ghcr.io/cerbos/cerbos:latest>
    restart: always
    command: ["server", "--config=/config/conf.yaml", "--log-level=warn"]
    volumes:
      - ./config:/config
      - ./auditlogs:/auditlogs
    depends_on:
      - database
    ports:
      - 3592:3592
      - 3593:3593
    networks:
      - intranet
Make sure that you have a directory named
auditlogs
created in the same directory as your Compose file
v

Vijey Deepan

01/27/2023, 9:18 AM
yes its there
volumes:
- ./config:/config
- ${PWD}/auditlogs/audit.log:/auditlogs/audit.log
working fine thanks for the help
🎉
2 Views