Filebeat locking files

Hi,

I installed filebeat to monitor logs. Below are the environment details:

OS: windows 7
filebeat version: 5.1.1

Config Details

Prospectors config:

  • input_type: log
    paths:
    • C:\myfiles\ELKStack\Learning*.log
      ignore_older: 5m
      force_close_files: true
      scan_frequency: 2s
      close_inactive: 1m

output.file:
path: "C:\myfiles\ELKStack\Output"
filename: filebeatout.txt

I am using powershell script to generate log file:
Add-content -path C:\myfiles\ELKStack\Learning\filebeattest.log "$(Get-Date) - This is log message $count"

Issue:

Filebeat locks log file and powershell script is generating below error while writing to log:
The process cannot access the file 'C:\myfiles\ELKStack\Learning\filebeattest.log' because it is being used by another process.

If filebeat continues to lock the file how can other processes access it? How to resolve the issue?

Thanks,
prat

Filebeat does not lock files. It opens the file for reading only. And it specifies that the file can be read, written, and deleted by other applications while it has it open.

It sounds like the thing that is trying to access the file is requesting exclusive access which it cannot get. It needs to allow other applications to read the file (FILE_SHARE_READ) when it opens the file.

1 Like

Thanks for reply.

I validated with different application which opened the file with read
share rights. It's working now.

Thanks,
Prathap

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