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

Separate log file or syslog target #299

Closed
Enormoss opened this issue Jul 24, 2019 · 8 comments
Closed

Separate log file or syslog target #299

Enormoss opened this issue Jul 24, 2019 · 8 comments

Comments

@Enormoss
Copy link

Enormoss commented Jul 24, 2019

I know that support for separate log was removed in previous versions.
Suhosin has capability to log to syslog.
It could be helpful to set internal logging to syslog.

E.g. to catch warnings about eval'd code. Now errors/warnings goes to PHP log facility and it can be overridden by user/attacker by settings error_log, error_reporting, display_errors etc.
So creating something setting like: stealth logging to syslog cloud be helpful.

@jvoisin
Copy link
Owner

jvoisin commented Jul 25, 2019

Interesting idea.

We can either:

  • provide some virtual-patching rules to prevent calling ini_set with logging-related parameters
  • add a logs_lockdown option, to prevent log-related modifications
  • add the possibility to log into the syslog, via syslog(3)

Thoughts?

@Enormoss
Copy link
Author

I already did some modification:
I added ini (PHP_INI_SYSTEM) settings:

    sp.log_syslog
    sp.log_zend

Which are boolean and then in sp_utils.c there is used syslog(3) and condition, where to log based on these settings.
If sp.log_zend is True (1) then stderr is also used.
This is only quick fix now. I'm not real C programmer. Currently I don't know if it will work under heavy load (syslog() call).

Now it is able to not to disturb php output and log to syslog.

Where to send patch?

@jvoisin
Copy link
Owner

jvoisin commented Jul 25, 2019

You can send a pull-request :)

@jvoisin
Copy link
Owner

jvoisin commented Aug 1, 2019

@Enormoss I just pushed a pull-request with a different approach (#303), what do you think about it?

@buixor
Copy link
Contributor

buixor commented Aug 20, 2019

In light of https://github.com/nbs-system/snuffleupagus/issues/307 this really makes sense.

@Enormoss
Copy link
Author

Yes, because e.g. in Webhosting provider environment it is better to simulate and silent log to file instead of disturb scripts.

@buixor
Copy link
Contributor

buixor commented Aug 20, 2019

https://github.com/nbs-system/snuffleupagus/pull/308

Need to decide if it makes sense not to openlog() in each sp_log_msg call tho

@jvoisin
Copy link
Owner

jvoisin commented Jun 19, 2020

This was done in 504f029.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants