# deleteStateOnFileMove

Removes the state file when a monitored file is moved or renamed.

This parameter applies to imfile: Text File Input Module.

Name:

  deleteStateOnFileMove

Scope:

  module, input

Type:

  boolean

Default:

  module=off; input=inherits module

Required?:

  no

Introduced:

  at least 8.x, possibly earlier

## Description

When set to `on` at module scope, the state file for a monitored file is removed when that file is moved or rotated away. By default the state file is kept.

The input parameter controls whether the state file is deleted when its associated file is moved or renamed. It inherits the module setting unless explicitly configured. Enabling it prevents orphaned state files.

## Module usage

    module(load="imfile" deleteStateOnFileMove="on")

## Input usage

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

## Notes

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

## 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.