{"record":{"id":"4a687b4e9e3a02e2","repo":"SigNoz/signoz","slug":"errcodeauditexportfailed","errorCode":"ErrCodeAuditExportFailed","errorMessage":"failed to open audit file %q","messagePattern":"failed to open audit file %q","errorType":"error_code","errorClass":null,"httpStatus":400,"severity":"critical","filePath":"ee/auditor/fileauditor/provider.go","lineNumber":42,"sourceCode":"\tbuild     version.Build\n\tserver    *auditorserver.Server\n\tmarshaler plog.JSONMarshaler\n\tfile      *os.File\n\tmu        sync.Mutex\n}\n\nfunc NewFactory(licensing licensing.Licensing, build version.Build) factory.ProviderFactory[auditor.Auditor, auditor.Config] {\n\treturn factory.NewProviderFactory(factory.MustNewName(\"file\"), func(ctx context.Context, providerSettings factory.ProviderSettings, config auditor.Config) (auditor.Auditor, error) {\n\t\treturn newProvider(ctx, providerSettings, config, licensing, build)\n\t})\n}\n\nfunc newProvider(_ context.Context, providerSettings factory.ProviderSettings, config auditor.Config, licensing licensing.Licensing, build version.Build) (auditor.Auditor, error) {\n\tsettings := factory.NewScopedProviderSettings(providerSettings, \"github.com/SigNoz/signoz/ee/auditor/fileauditor\")\n\n\tfile, err := os.OpenFile(config.File.Path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o644)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, errors.TypeInvalidInput, auditor.ErrCodeAuditExportFailed, \"failed to open audit file %q\", config.File.Path)\n\t}\n\n\tprovider := &provider{\n\t\tsettings:  settings,\n\t\tconfig:    config,\n\t\tlicensing: licensing,\n\t\tbuild:     build,\n\t\tmarshaler: plog.JSONMarshaler{},\n\t\tfile:      file,\n\t}\n\n\tserver, err := auditorserver.New(settings,\n\t\tauditorserver.Config{\n\t\t\tBufferSize:    config.BufferSize,\n\t\t\tBatchSize:     config.BatchSize,\n\t\t\tFlushInterval: config.FlushInterval,\n\t\t},\n\t\tprovider.export,","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/ee/auditor/fileauditor/provider.go#L24-L60","documentation":"The SigNoz EE file auditor provider failed to os.OpenFile the configured audit log path with append/create/write-only mode; the OS error is wrapped with code ErrCodeAuditExportFailed.","triggerScenarios":"Starting SigNoz EE with auditor type \"file\" where config.File.Path points to a directory that doesn't exist, a read-only filesystem, a permission-denied location, or a path that is itself a directory.","commonSituations":"Running the container as a non-root user without write access to /var/signoz or the mounted volume; path typo or missing parent dir; container with read-only root FS and no volume for audit logs; SELinux denials.","solutions":["Verify the path's parent directory exists and is writable by the signoz process user (mkdir -p && chown)","Mount a writable volume at the audit path in docker/k8s","Fix the configured path (remove trailing slash / ensure it's a file path, not a directory)","Relax SELinux/AppArmor or run with correct fsGroup in k8s"],"exampleFix":"# before\nfile:\n  path: /var/log/signoz/audit.log  # dir missing, no perms\n# after\nmkdir -p /var/log/signoz && chown signoz:signoz /var/log/signoz\n# or mount a volume at that path","handlingStrategy":"fallback","validationCode":"path := cfg.File.Path\nif fi, err := os.Stat(filepath.Dir(path)); err != nil || !fi.IsDir() { log.Fatal(\"audit dir missing/not a dir:\", filepath.Dir(path)) }\nif err := unix.Access(path, unix.W_OK); err != nil { /* fix perms before start */ }","typeGuard":null,"tryCatchPattern":"if _, err := fileauditor.New(ctx, settings, cfg, lic, build); err != nil { if strings.Contains(err.Error(), \"failed to open audit file\") { fix perms/dir; retry once }; else { fatal } }","preventionTips":["Pre-create audit dir with correct ownership in Dockerfile/k8s manifests","Mount a dedicated writable volume for audit logs","Run container healthchecks that touch the audit file path at startup"],"tags":["signoz","auditor","file-permissions","filesystem","deployment"],"backgroundTag":"file-open-permission-denied","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}