# deleteStateOnFileDelete

Removes the state file when the monitored file is deleted.

This parameter applies to imfile: Text File Input Module.

Name:

  deleteStateOnFileDelete

Scope:

  input

Type:

  boolean

Default:

  on

Required?:

  no

Introduced:

  at least 5.x, possibly earlier

## Description

Controls whether the state file is deleted if its associated main file is removed. This usually prevents problems when a new file with the same name is created. However, if a monitored file is modified with an editor that replaces the file, deleting the state file would cause the whole file to be reprocessed. Disable this setting only when the reason is fully understood.

## Input usage

    input(type="imfile"
          File="/var/log/example.log"
          Tag="example"
          deleteStateOnFileDelete="on")

## Notes

- Legacy documentation used the term `binary` for the type. It is treated as boolean.

### Legacy names (for reference)

Historic names/directives for compatibility. Do not use in new configs.

- `removeStateOnDelete` — maps to deleteStateOnFileDelete (status: legacy)

## See also

See also imfile: Text File Input Module.

Support: rsyslog Assistant | GitHub Discussions | GitHub Issues: rsyslog source project

Contributing: Source & docs: rsyslog source project

© 2008–2025 Rainer Gerhards and others. Licensed under the Apache License 2.0.