[GH-ISSUE #76] Support for journalctl #52

Closed
opened 2026-03-03 16:04:01 +03:00 by kerem · 10 comments
Owner

Originally created by @acklenx on GitHub (Aug 31, 2016).
Original GitHub issue: https://github.com/mthenw/frontail/issues/76

My apps run through systemd and logging is handled with journalctl. From the command line when I want to quickly view the log i usually type this:
sudo journalctl -n 50 -f -u mysite.com.service

but journalctl isn't exactly a file so that doesn't work. I think I can pip the non-interactive result to a file like so:
sudo journalctl -u mysite.com.service | tail -n 50

at least that outputs as expected on the command line... but not when I put frontail in front. and of course i can't use the -F option as is indicated (the it may just be to support the user mental model) in the web view.
sudo journalctl -u mysite.com.service | tail -F
tail: cannot follow ‘-’ by name

hopefully I'm just missing something obvious, in the meanwhile I'll see if i can't just log to multiple locations (syslog and journalctl)

Originally created by @acklenx on GitHub (Aug 31, 2016). Original GitHub issue: https://github.com/mthenw/frontail/issues/76 My apps run through systemd and logging is handled with journalctl. From the command line when I want to quickly view the log i usually type this: sudo journalctl -n 50 -f -u mysite.com.service but journalctl isn't exactly a file so that doesn't work. I think I can pip the non-interactive result to a file like so: sudo journalctl -u mysite.com.service | tail -n 50 at least that outputs as expected on the command line... but not when I put frontail in front. and of course i can't use the -F option as is indicated (the it may just be to support the user mental model) in the web view. sudo journalctl -u mysite.com.service | tail -F tail: cannot follow ‘-’ by name hopefully I'm just missing something obvious, in the meanwhile I'll see if i can't just log to multiple locations (syslog and journalctl)
kerem closed this issue 2026-03-03 16:04:02 +03:00
Author
Owner

@acklenx commented on GitHub (Aug 31, 2016):

My feeble attempts to hack on lib/tail.js met resistance as well:
(line 24)
// tail = childProcess.spawn('tail', ['-n', options.buffer, '-F'].concat(path));
// tail = childProcess.spawn('journalctl -u peerpreview.com.service | tail f -n 50 ');
tail = childProcess.spawn('journalctl' ,['-u', 'peerpreview.com.service', ,'|', 'tail', ,'f', '-n', '50']);

$ sudo frontail blah
Failed to add match '|': Invalid argument
Failed to add filters: Invalid argument

<!-- gh-comment-id:243820921 --> @acklenx commented on GitHub (Aug 31, 2016): My feeble attempts to hack on lib/tail.js met resistance as well: (line 24) // tail = childProcess.spawn('tail', ['-n', options.buffer, '-F'].concat(path)); // tail = childProcess.spawn('journalctl -u peerpreview.com.service | tail f -n 50 '); tail = childProcess.spawn('journalctl' ,['-u', 'peerpreview.com.service', ,'|', 'tail', ,'f', '-n', '50']); $ sudo frontail blah Failed to add match '|': Invalid argument Failed to add filters: Invalid argument
Author
Owner

@acklenx commented on GitHub (Aug 31, 2016):

This starts OK, but the log is essentially empty (whereas executing the command on the command line works as expected). I start frontail with sudo and type junk for a second argument (it is displayed on the webpage, but unused to spawn)

tail = childProcess.spawn('journalctl' ,[ '-u peerpreview.com.service | tail -f -n 50']);
and the webpage with logs contains only this:
-- Logs begin at Tue 2016-08-30 09:33:32 EDT, end at Wed 2016-08-31 12:35:53 EDT. --

<!-- gh-comment-id:243824254 --> @acklenx commented on GitHub (Aug 31, 2016): This starts OK, but the log is essentially empty (whereas executing the command on the command line works as expected). I start frontail with sudo and type junk for a second argument (it is displayed on the webpage, but unused to spawn) tail = childProcess.spawn('journalctl' ,[ '-u peerpreview.com.service | tail -f -n 50']); and the webpage with logs contains only this: -- Logs begin at Tue 2016-08-30 09:33:32 EDT, end at Wed 2016-08-31 12:35:53 EDT. --
Author
Owner

@mthenw commented on GitHub (Sep 4, 2016):

Hey,

thanks for reporting. The best way to solve that would be to support stdin (https://github.com/mthenw/frontail/issues/68) as a input. I don't have time currently to implement that. Are you interested in contributing?

<!-- gh-comment-id:244614692 --> @mthenw commented on GitHub (Sep 4, 2016): Hey, thanks for reporting. The best way to solve that would be to support stdin (https://github.com/mthenw/frontail/issues/68) as a input. I don't have time currently to implement that. Are you interested in contributing?
Author
Owner

@acklenx commented on GitHub (Sep 4, 2016):

Can that be done from the node side? Probably out of my league either way,
but I'll take a look.

On Sep 4, 2016 13:01, "Maciej Winnicki" notifications@github.com wrote:

Hey,

thanks for reporting. The best way to solve that would be to support stdin
(#68 https://github.com/mthenw/frontail/issues/68) as a input. I don't
have time currently to implement that. Are you interested in contributing?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/mthenw/frontail/issues/76#issuecomment-244614692, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAQ70oQBVB65kLzScQtIeQGa6l7M_Fquks5qmvmBgaJpZM4Jxx0H
.

<!-- gh-comment-id:244622077 --> @acklenx commented on GitHub (Sep 4, 2016): Can that be done from the node side? Probably out of my league either way, but I'll take a look. On Sep 4, 2016 13:01, "Maciej Winnicki" notifications@github.com wrote: > Hey, > > thanks for reporting. The best way to solve that would be to support stdin > (#68 https://github.com/mthenw/frontail/issues/68) as a input. I don't > have time currently to implement that. Are you interested in contributing? > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > https://github.com/mthenw/frontail/issues/76#issuecomment-244614692, or mute > the thread > https://github.com/notifications/unsubscribe-auth/AAQ70oQBVB65kLzScQtIeQGa6l7M_Fquks5qmvmBgaJpZM4Jxx0H > .
Author
Owner

@mthenw commented on GitHub (Oct 5, 2016):

Hey,

I've provided a way to stream stdin so in your case you need to run

sudo journalctl -u mysite.com.service | frontail -
<!-- gh-comment-id:251656246 --> @mthenw commented on GitHub (Oct 5, 2016): Hey, I've provided a way to stream stdin so in your case you need to run ``` sudo journalctl -u mysite.com.service | frontail - ```
Author
Owner

@acklenx commented on GitHub (Oct 5, 2016):

Great! .... but I still don't see anything. Did you push this change? I just did a fresh install (sudo) and frontail starts (I can load it on port 9001) but the command line shows nothing and the log is empty. But if I run the command without the pipe to frontail i get a few lines from the log. I also tried with -f for follow, but that didn't do anything. Of interest the first few times I could just hit CTRL+C and exit and restart, but the last time I add port didn't free up. this may have been related to how I exited (I didn't pay enough attention).

Thanks for looking at this

<!-- gh-comment-id:251709895 --> @acklenx commented on GitHub (Oct 5, 2016): Great! .... but I still don't see anything. Did you push this change? I just did a fresh install (sudo) and frontail starts (I can load it on port 9001) but the command line shows nothing and the log is empty. But if I run the command without the pipe to frontail i get a few lines from the log. I also tried with -f for follow, but that didn't do anything. Of interest the first few times I could just hit CTRL+C and exit and restart, but the last time I add port didn't free up. this may have been related to how I exited (I didn't pay enough attention). Thanks for looking at this
Author
Owner

@mthenw commented on GitHub (Oct 5, 2016):

What frontail version are you running? You can check that with frontail --version.

<!-- gh-comment-id:251712070 --> @mthenw commented on GitHub (Oct 5, 2016): What frontail version are you running? You can check that with `frontail --version`.
Author
Owner

@acklenx commented on GitHub (Oct 5, 2016):

4.01

<!-- gh-comment-id:251715697 --> @acklenx commented on GitHub (Oct 5, 2016): 4.01
Author
Owner

@mthenw commented on GitHub (Oct 5, 2016):

does sudo journalctl output something?

<!-- gh-comment-id:251720498 --> @mthenw commented on GitHub (Oct 5, 2016): does `sudo journalctl` output something?
Author
Owner

@acklenx commented on GitHub (Oct 5, 2016):

sudo journalctl
dumps a ton of stuff
but I use
sudo journalctl -u peerpreview.com.service
for my app (replacing mysite with peerpreview)
and
sudo journalctl -u peerpreview.com.service -f
will follow/tail as expected.

sample output pasted below ( don't follow/load any of those url's in your browsers, we track and analyze nasty/malicious webpages so these could be really bad for your computer's health)

acklenx@localhost:~/www/peerpreview.com/cache/t.co$ sudo journalctl -u peerpreview.com.service -f
-- Logs begin at Mon 2016-10-03 16:30:06 EDT. --
Oct 05 15:41:16 localhost peerpreview.js[4558]: HTTP request sent, awaiting response... 200 OK
Oct 05 15:41:16 localhost peerpreview.js[4558]: Length: 3476 (3.4K) [image/png]
Oct 05 15:41:16 localhost peerpreview.js[4558]: Saving to: ‘/home/acklenx/www/peerpreview.com/cache/brasfacfomentomercantil.com.br/562920145/direitosocioambiental.org/modulodeseguranca/images/9.png’
Oct 05 15:41:16 localhost peerpreview.js[4558]: 0K ... 100% 138M=0s
Oct 05 15:41:16 localhost peerpreview.js[4558]: 2016-10-05 15:41:16 (138 MB/s) - ‘/home/acklenx/www/peerpreview.com/cache/brasfacfomentomercantil.com.br/562920145/direitosocioambiental.org/modulodeseguranca/images/9.png’ saved [3476/3476]
Oct 05 15:41:16 localhost peerpreview.js[4558]: FINISHED --2016-10-05 15:41:16--
Oct 05 15:41:16 localhost peerpreview.js[4558]: Total wall clock time: 4.2s
Oct 05 15:41:16 localhost peerpreview.js[4558]: Downloaded: 9 files, 167K in 2.8s (59.6 KB/s)
Oct 05 15:41:16 localhost peerpreview.js[4558]: Converting /home/acklenx/www/peerpreview.com/cache/brasfacfomentomercantil.com.br/562920145/brasfacfomentomercantil.com.br/recadastro2016/index.html... 8-1
Oct 05 15:41:16 localhost peerpreview.js[4558]: Converted 1 files in 0.001 seconds.

<!-- gh-comment-id:251791933 --> @acklenx commented on GitHub (Oct 5, 2016): sudo journalctl dumps a ton of stuff but I use sudo journalctl -u peerpreview.com.service for my app (replacing mysite with peerpreview) and sudo journalctl -u peerpreview.com.service -f will follow/tail as expected. sample output pasted below ( don't follow/load any of those url's in your browsers, we track and analyze nasty/malicious webpages so these could be really bad for your computer's health) acklenx@localhost:~/www/peerpreview.com/cache/t.co$ sudo journalctl -u peerpreview.com.service -f -- Logs begin at Mon 2016-10-03 16:30:06 EDT. -- Oct 05 15:41:16 localhost peerpreview.js[4558]: HTTP request sent, awaiting response... 200 OK Oct 05 15:41:16 localhost peerpreview.js[4558]: Length: 3476 (3.4K) [image/png] Oct 05 15:41:16 localhost peerpreview.js[4558]: Saving to: ‘/home/acklenx/www/peerpreview.com/cache/brasfacfomentomercantil.com.br/562920145/direitosocioambiental.org/modulodeseguranca/images/9.png’ Oct 05 15:41:16 localhost peerpreview.js[4558]: 0K ... 100% 138M=0s Oct 05 15:41:16 localhost peerpreview.js[4558]: 2016-10-05 15:41:16 (138 MB/s) - ‘/home/acklenx/www/peerpreview.com/cache/brasfacfomentomercantil.com.br/562920145/direitosocioambiental.org/modulodeseguranca/images/9.png’ saved [3476/3476] Oct 05 15:41:16 localhost peerpreview.js[4558]: FINISHED --2016-10-05 15:41:16-- Oct 05 15:41:16 localhost peerpreview.js[4558]: Total wall clock time: 4.2s Oct 05 15:41:16 localhost peerpreview.js[4558]: Downloaded: 9 files, 167K in 2.8s (59.6 KB/s) Oct 05 15:41:16 localhost peerpreview.js[4558]: Converting /home/acklenx/www/peerpreview.com/cache/brasfacfomentomercantil.com.br/562920145/brasfacfomentomercantil.com.br/recadastro2016/index.html... 8-1 Oct 05 15:41:16 localhost peerpreview.js[4558]: Converted 1 files in 0.001 seconds.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/frontail#52
No description provided.