# PersistStateInterval

Controls how often the state file is written based on processed line count.

This parameter applies to imfile: Text File Input Module.

Name:

  PersistStateInterval

Scope:

  input

Type:

  integer

Default:

  0

Required?:

  no

Introduced:

  at least 5.x, possibly earlier

## Description

Specifies how often the state file is written when processing the input file. A value of `0` means the state file is written when the monitored file is closed, typically at rsyslog shutdown. Any other value `n` causes the state file to be written after at least every `n` processed lines. This setting can guard against message duplication due to fatal errors but may reduce performance if set to a low value. Rsyslog may write state files more frequently if needed.

Note: If this parameter is not set, state files are not created.

## Input usage

    input(type="imfile"
          File="/var/log/example.log"
          Tag="example"
          PersistStateInterval="0")

### Legacy names (for reference)

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

- `$InputFilePersistStateInterval` — maps to PersistStateInterval (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.