ERROR [om_file|file] failed to open C:\Users\Administrator\Documents\Data; Access is denied.


#1 billychua (Last updated )

Hi,

I get the above error when I tried to start nxlog server. Below is my config file. Please assists. thank you

 

Panic Soft

define INSTALLDIR C:\Program Files\nxlog

#ModuleDir %INSTALLDIR%\modules#CacheDir  %INSTALLDIR%\data#SpoolDir  %INSTALLDIR%\data

define CERTDIR %INSTALLDIR%\certdefine CONFDIR %INSTALLDIR%\conf\nxlog.d

# Note that these two lines define constants only; the log file location# is ultimately set by the `LogFile` directive (see below). The# `MYLOGFILE` define is also used to rotate the log file automatically# (see the `_fileop` block).define LOGDIR c:\datadefine MYLOGFILE %INSTALLDIR%\data\nxlog.log

# If you are not using NXLog Manager, disable the `include` line# and enable LogLevel and LogFile.#include %CONFDIR%\*.conf

LogLevel    INFOLogFile     %MYLOGFILE%

<Extension exec>   Module        xm_exec</Extension>

<Extension _syslog>   Module  xm_syslog</Extension>

<Extension fileop>   Module      xm_fileop</Extension>

# This block rotates `%MYLOGFILE%` on a schedule. Note that if `LogFile`# is changed in managed.conf via NXLog Manager, rotation of the new# file should also be configured there.<Extension _fileop>   Module  xm_fileop

   # Check the size of our log file hourly, rotate if larger than 5MB   <Schedule>       Every   1 hour       <Exec>           if ( file_exists('%MYLOGFILE%') and                (file_size('%MYLOGFILE%') >= 5M) )           {                file_cycle('%MYLOGFILE%', 8);           }       </Exec>   </Schedule>

   # Rotate our log file every week on Sunday at midnight   <Schedule>       When    @weekly       Exec    if file_exists('%MYLOGFILE%') file_cycle('%MYLOGFILE%', 8);   </Schedule></Extension>

<Input tcp>   Module      im_tcp   ListenAddr  0.0.0.0:514</Input>

define LOCALFILE  'C:\Users\Administrator\Documents\Data'<Output file>   Module  om_file   File    %LOCALFILE%</Output>

<Route tcp_to_file>   Path    tcp => file</Route>

 

Error Message:

2023-02-06 00:41:43 INFO [CORE|main] nxlog-5.6.7727 (50b2a4353@REL_v5.6) started on Windows
2023-02-06 00:41:43 ERROR [om_file|file] failed to open C:\Users\Administrator\Documents\Data; Access is denied.  
2023-02-06 00:41:43 INFO [im_tcp|tcp] listening on 0.0.0.0:514

 

Regards, Billy

#2 gahorvath Nxlog ✓

Hi Billy,

the NXLog runs as Local System. If that account has no access to the file or the location the file is in, it won't be able to read it.

You have two options:

  1. adjust permissions to allow Local System to read the file
  2. change the run user for the service to one that can access the file

Both of these have potential complications, please consider carefully before changing the configuration.

Gabor