mirror of
https://github.com/mthenw/frontail.git
synced 2026-04-26 10:15:52 +03:00
[GH-ISSUE #76] Support for journalctl #52
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/frontail#52
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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)
@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
@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. --
@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?
@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:
@mthenw commented on GitHub (Oct 5, 2016):
Hey,
I've provided a way to stream stdin so in your case you need to run
@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
@mthenw commented on GitHub (Oct 5, 2016):
What frontail version are you running? You can check that with
frontail --version.@acklenx commented on GitHub (Oct 5, 2016):
4.01
@mthenw commented on GitHub (Oct 5, 2016):
does
sudo journalctloutput something?@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.