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

Read from pipe #12

Open
LeNouveau opened this issue Nov 2, 2018 · 3 comments
Open

Read from pipe #12

LeNouveau opened this issue Nov 2, 2018 · 3 comments

Comments

@LeNouveau
Copy link

Hi,

Would be nice to be able to pipe the input.
Example of how I would like to use it :

docker logs 0e9fcbe6e5b2 -f | Select-String -Pattern "^{" | jv

Please notice the -f in docker's parameters.
So, no need to re-run the command to refresh results.

Do you think it's possible ?

Regards,
LeNouveau

@dieterrosch
Copy link

dieterrosch commented May 30, 2020

As a work around, what I do is to use a named-pipe on linux.
Eg.

mkfifo jvfifo #need to do this once to create the fifo

then in one terminal

docker logs 0e9fcbe6e5b2 -f | Select-String -Pattern "^{" > jvfifo

and in another terminal window

jv jvfifo

Sadly I don't know of a way to do this on a Windows machine, Windows terminal support is worse than atrocious.

@omidkrad
Copy link

omidkrad commented Jun 8, 2021

Piping is the feature that will make this nice log viewer actually usable for me.

@Budgiebrain994
Copy link

As a work around, what I do is to use a named-pipe on linux.
Eg.

mkfifo jvfifo #need to do this once to create the fifo

then in one terminal

docker logs 0e9fcbe6e5b2 -f | Select-String -Pattern "^{" > jvfifo

and in another terminal window

jv jvfifo

Sadly I don't know of a way to do this on a Windows machine, Windows terminal support is worse than atrocious.

Taking a look at the source code, unfortunately it looks like the log viewer loads the entire log file using readFileSync and converts it to a string, instead of using a buffer or a stream. In that case, if using a named-pipe of stdin for the input, the JSON log viewer would stall until stdin ends, which iirc doesn't happen until Ctrl+D.

We'd need to switch the readFileSync with a buffer/stream implementation.

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

No branches or pull requests

4 participants