Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying log files in file_reader using glob patterns #44

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

souryogurt
Copy link

@souryogurt souryogurt commented Jan 19, 2023

Description of the Change

Users of file_reader module want to track log files of applications with enabled rotation. In this case, they do not know the exact name of the files to be tracked, and they would like to specify them using glob patterns.

Log files can now be specified using glob patterns.

Closes #8

Changelog Entry

Added ability to specify log files in file_reader using glob patterns.

Checklist:

  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@souryogurt souryogurt requested a review from asdek January 19, 2023 17:14
@souryogurt souryogurt self-assigned this Jan 19, 2023
@souryogurt souryogurt force-pushed the feature-file_reader-track-files-matching-patterns branch from a34e721 to d3519d2 Compare January 19, 2023 17:23
Egor Artemov added 6 commits January 20, 2023 01:34
Users of file_reader module want to track log files of applications with
enabled rotation. In this case, they do not know the exact name of the
files to be tracked, and they would like to specify them using glob
patterns. Log files can now be specified using glob patterns. But only
files existing during module configuration will be tracked.
The function wasn't attaching directory path to the names of files.
This module tracks files specified using wildcard patterns already. It
finds such files during configuration.

Nevertheless, to track new files created after the module's
configuration, the module must constantly monitor directories and keep
looking for files added. For this, the DirectoryWatcher has been
created.
The directory watcher approach was too error-prone in the agent's
environment. It didn't call the function of stopping watchers, which
caused crashes sometimes.

Rather than monitoring directory changes reactively, the module scans
the directory proactively every second now.
The module periodically scans directories for files matching wildcard
patterns specified by the user. The interval between scans is
customizable with the "period" parameter.
UI let's you select a file to start reading from the beginning.
Unfortunately, the list got broken after wildcards were added.

Instead of using the configuration list, the browser part now gets the
current watched list directly from the agent during initialization.
@souryogurt souryogurt force-pushed the feature-file_reader-track-files-matching-patterns branch from d3519d2 to e8212d5 Compare January 19, 2023 17:34
Egor Artemov and others added 5 commits February 13, 2023 15:44
It is better to check the operating system directly from the tests
themselves and disable them rather than having large "if" blocks that
selects tests to run.
The file_reader was crashing in case the savepoint file used to store
the latest position in tracked files was empty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Module doesn't read several files
3 participants