Skip to content

logfile: The check does not detect that the log file has been rewritten from the beginning #1330

Description

@CMorDat

This issue respects the following points:

Which variant of the Monitoring Plugins do you use?

  • .rpm/.deb package from repo.linuxfabrik.ch
  • Compiled for Windows from download.linuxfabrik.ch
  • Source Code from GitHub

Bug description

The check/plugin fails to detect new log entries when the log file is rewritten from the beginning rather than having new entries appended to the existing content.

Steps to reproduce - Plugin call

'/usr/lib64/nagios/plugins/logfile' '--alarm-duration' '10' '--critical-regex' 'Das ist ein Fehler' '--filename' '/home/test.log'

Steps to reproduce - Data

  1. Create the log file /home/test.log
  2. Add the following line to the log file: 2026-07-08 12:43:44 Das ist ein Fehler
  3. Run the Icinga check.
  4. Add the following line to the log file, overwriting the log entry that was added in step 2: 2026-07-08 12:46:25 Das ist ein Fehler
  5. Run the Icinga check.
  6. Repeat steps 4 and 5 until the alarm duration specified in the check (--alarm-duration '10') has elapsed. Each time you repeat step 4, update the timestamp at the beginning of the log entry to the current time while keeping the rest of the log message unchanged.

No response

Environment

RHEL 8.10

Plugin Version

logfile: v2026060101 by Linuxfabrik GmbH, Zurich/Switzerland

Python version

Python 3.6.8

List of Python modules

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions