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

luci-base: allow direct syslog login for perror #4925

Merged
merged 1 commit into from
Apr 30, 2021

Conversation

ja-pa
Copy link
Contributor

@ja-pa ja-pa commented Mar 16, 2021

This PR replaces io.stderr:write with perror in dispatcher.lua and modifies perror in such way, that in can send error messages to stderr or syslog based on value stored in /etc/config/luci

luci.main.log='syslog'
or
luci.main.log='stderr'

Fixes #4877

Signed-off-by: Jan Pavlinec jan.pavlinec@nic.cz

@jow-
Copy link
Contributor

jow- commented Mar 16, 2021

Why is this needed?

@ja-pa
Copy link
Contributor Author

ja-pa commented Mar 23, 2021

This change is useful mainly in case that someone is running luci without uhttpd. Usually in that case LuCI error messages are not sent to syslog.(see https://forum.openwrt.org/t/luci-code-that-handles-failed-and-success-login-results-to-syslog/83776 )
This change adds the possibility to send error messages directly to syslog but still preserves previous behavior.

@ja-pa
Copy link
Contributor Author

ja-pa commented Apr 26, 2021

Rebased on master
@feckert @jow- What do you think about this change?

@feckert
Copy link
Member

feckert commented Apr 27, 2021

From my point of view, that's OK.
If there are no objections @jow- then I will merge this the next few days.

I can't find it now but can we document the new option somewhere?
I'm not sure if we already have something in the openwrt wiki aboutt LuCI

@feckert feckert self-assigned this Apr 27, 2021
@jow-
Copy link
Contributor

jow- commented Apr 27, 2021

tbh I am not overly happy with the added complexity just to send two messages to syslog. Feel free to replace the stderr writes with nixio.syslog() invocations but do not introduce new options and alternative code paths for this.

Note: This change is relevant for systems that don't
use uhttpd for LuCI.
This log can be later used for fail2ban etc.

Signed-off-by: Jan Pavlinec <jan.pavlinec@nic.cz>
@ja-pa
Copy link
Contributor Author

ja-pa commented Apr 30, 2021

I removed additional logic and replaced it with nixio.syslog.
Run tested on my Omnia

@ja-pa ja-pa changed the title RFC luci-base: allow direct syslog login for perror luci-base: allow direct syslog login for perror Apr 30, 2021
@feckert feckert merged commit 095912d into openwrt:master Apr 30, 2021
@feckert
Copy link
Member

feckert commented Apr 30, 2021

Thanks

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.

RFC: LuCI failed/successful logging to syslog
3 participants