-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
luci-mod-status: display log_file in status if defined #7187
Conversation
modules/luci-mod-status/root/usr/share/rpcd/acl.d/luci-mod-status.json
Outdated
Show resolved
Hide resolved
Is it certain that the wrapper script passes the same exit codes as logread? In general this is a good idea, although I think other devs would want to see the wrapper go in to a different repo. I don't think there's any real merit in doing so, since the GUI is the only place it gets leveraged here. |
ed58ae8
to
5a98663
Compare
This is a good point and I checked that there are the same return codes. |
Commit includes wrapper syslog in /usr/libexec. If a log file is configured, the output of this file is displayed. Otherwise the output of logread is displayed. Signed-off-by: Christian Korber <ckorber@tdt.de>
I made the necessary changes, @systemcrash I am looking forward to your review. |
|
||
return fs.exec_direct(logger, [ '-e', '^' ]).then(logdata => { | ||
return fs.exec_direct(logger).then(logdata => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you excised the ternary operator above - which more than anything looks like a sanity check in case stat[n]
is null. Maybe a null check and handling isn't bad here after all. We would already be in some weird place because to arrive at this state implies that the wrapper is absent for some reason. I guess it's no worse anyway, because the old 'resolves' had null as a default. What does exec_direct
do in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could also bring back the ternary operator
var logger = stat[0] ? stat[0].path : null;
,
but as you already said it would be a weird place and the Promise already returns null in that case.
From the docs:
exec_direct
executes the command while bypassing ubus with cgi-io helper applet at `cgi-bin/cgi-exec'. It is useful to fetch large command outputs, which may exceed the ubus message size limits. It also enforces the same access permission rules as the ubus base exec call.
Merged. Thanks @Chris1189 |
Sorry, that missed review of the PR. The Instead the syslog-ng created a shell script wrapper that reads logs from the log file. The script has a different path that's why in the LogView we need to detect which logread is installed. I made a PR to the syslog-ng that will change the symlink the logread script once the syslog-ng is installed. Then the command will be the same whatever the logread implementation is in use and the LogView can be simplified. Your implementation goes even further and it tries to read a log file itself instead of asking the logread command to do this. log_file="$(uci_get system @system[0] log_file "")"
if [ -f "$log_file" ]; then
cat "$log_file"
return
fi You don't pass the As far I understood you wish to receive all the saved logs, not just those that the logd has in a ring buffer. Here are sources of the logread https://github.com/openwrt/ubox/blob/master/log/logread.c#L148 Also check the OpenWrt Wiki: Logging messages page for some details. So for now I would recommend to revert the commit (since it has breaking changes), merge the PR with alternatives, then simplify the logic here (maybe later). But the archival log reading from a file should be decided separately. Do we really need the feature? |
@stokito we determined that -F is a write only parameter, not read. Ie destination file. is there a good way to reconcile these disparities? |
oh, yes it's used to redirect logs to the file. |
Perhaps it’s time for an option to read from a specific file.
So the only problem is log filtering…? The -e option only ever filters for
line start. So unless the log pages get some filter option, what’s the win?
(Js can filter by itself without relying on underlying binaries).
|
I agree with @stokito here, don't implement parallel infrastructure in the gui, don't attempt to read log files directly when cli level commands exist for that purpose. |
Is that what you assess has happened here? The script still leverages |
What happens here is that LuCI starts implementing log related infrastructure code, this belongs into base first. |
As @systemcrash mentioned From the messages you wrote to the discussion I gathered that you wish to add the filter option My intent was not to implement parallel infrastructure but to add a feature. I want to read the file if it is set. |
Commit includes wrapper syslog in /usr/libexec. If a log file is configured, the output of this file is displayed. Otherwise the output of logread is displayed.