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

Feature/line seeker #108

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

Conversation

StoicPerlman
Copy link

@StoicPerlman StoicPerlman commented Jan 22, 2017

This is a a rough draft for issue #83 seek by line. Any feedback will be in PR update.

See https://github.com/StoicPerlman/fls to get info on how line seeking works

Tests pass locally in docker build but not in travis. Still working on this. Any advice would be helpful as I am pretty new to travis and go.

@StoicPerlman
Copy link
Author

StoicPerlman commented Dec 29, 2017

@Nino-K This is passing now for 1.7+. This is because my package is using io.SeekStart, which replaced os.SEEK_SET in 1.7. I can update my package to handle this if its important to you. But maybe tail could drop those while adding 1.9? I have another PR that removed os.SEEK from tail and drops 1.5 and 1.6 from travis.

@StoicPerlman
Copy link
Author

Added line seeker to gotail cmd. Switched -n from using position in file to lines.

@nishantroy
Copy link

@StoicPerlman any updates here?

@StoicPerlman
Copy link
Author

@nishantroy This is working just fine for me. No word from the project maintainers.

If you check out the Travis build you can see this PR its passing for Go 1.7+. I have another PR on this repo to remove some deprecated go features and drop support for under 1.7.

I added this functionality by creating a library which is also passing all tests on master branch for 1.7+ If you are interested in looking it over you can find it here https://travis-ci.org/StoicPerlman/fls.

If you want this functionality now just used my forked version until this gets merged. https://github.com/StoicPerlman/tail.

Pipe bool // Is a named pipe (mkfifo)
RateLimiter *ratelimiter.LeakyBucket
Location *SeekInfo // Seek to this location before tailing
LineLocation *SeekInfo // Seek to this line number before tailing
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nishantroy To make this work just set this LineLocation in the config. It works the the same way Location works, but instead of moving by position it moves by \n's.

Also see the README on the underlying library https://github.com/StoicPerlman/fls. If you have trouble using it just shoot me a message.

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.

None yet

3 participants