Improve FTL startup detection and log tailing - #1940
Merged
Conversation
…ng FTL. We will use this as a starting point to: - Check that FTL has started when grepping for the "FTL Started" string - Position to start tailing from when streaming the log file We wait for a maximum of 30 seconds for FTL to start, else we exit the container Co-authored-by: yubiuser <github@yubiuser.dev> Co-authored-by: casperklein <casperklein@users.noreply.github.com> Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This was referenced Nov 6, 2025
rdwebdesign
previously approved these changes
Nov 6, 2025
rdwebdesign
left a comment
Member
There was a problem hiding this comment.
Looks like this is working as expected.
Member
|
Is this for a new container with a new and empty volume or for updated containers with a previously used volume? |
Member
Author
|
Little from column a), little from column b). It takes into account:
|
Member
++ getFTLConfigValue files.log.ftl
++ pihole-FTL --config -q files.log.ftl
+ FTLlogFile=/var/log/pihole/FTL.log
+ local startFrom
++ stat -c%s /var/log/pihole/FTL.log
+ startFrom=7050
+ echo ' [i] Starting pihole-FTL (no-daemon) as pihole'
[i] Starting pihole-FTL (no-daemon) as pihole
+ echo ''
+ CAPSH_PID=413
+ capsh --user=pihole --keep=1 -- -c '/usr/bin/pihole-FTL no-daemon >/dev/null'
+ + timeout 30 grep tail -q -F -c +7051 -- /var/log/pihole/FTL.log
'########## FTL started'
2025-11-06 19:21:17.808 UTC [416M] INFO: ########## FTL started on 5bd113d534f7! ##########Looks like it does what it says. I'm not sure how to test the 30 second timeout failure though? |
dschaper
reviewed
Nov 6, 2025
Member
Author
Co-authored-by: Dan Schaper <dan.schaper@pi-hole.net> Signed-off-by: Adam Warner <me@adamwarner.co.uk>
dschaper
approved these changes
Nov 6, 2025
rdwebdesign
approved these changes
Nov 6, 2025
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What does this PR aim to accomplish?:
This PR take a little logic from #1932, and a little from #1934
Both are good ideas, but I want to combine and tweak them a little. For example, I do not want to use the
pihole-FTL wait-forcommand, as it does not quite suit the purpose we are looking for, but I do want to exit the container if FTL has not started within 30 seconds - else it will just hang.I also like the idea of reading the FTL log filesize on container start, and then basing all interaction with the log file from that point onwards.
By submitting this pull request, I confirm the following:
git rebase)