0

How do I programatically set log level in syslog-ng?

So for I have set the log level by editing /etc/syslog-ng/syslog-ng.conf and restarting the syslog-ng service.

service syslog-ng restart.

I have a php app and I want users to be able to set the log level from the web UI.

How to I programatically set the log level for syslog-ng using either php/linux?

I've seen something about setlogmask($mask_priority) but I can't see how I can use this using php/linux.

Thanks

Mulvihic
  • 295
  • 1
  • 2
  • 10

1 Answers1

0

PHP have some functions to invoke shell commands/scripts. Check these 2 links:

PHP shell_exec function

Stackoverflow - PHP - exec() vs system() vs passthru()

If you need to do sudo with no password you'll have to insert the apache user into the sudoers file and specify/modify the use of no password for that user. Though this seems to me a huge security hole, if somebody achieves to log as apache user then he'll become root.

https://askubuntu.com/questions/168461/how-do-i-sudo-without-having-to-enter-my-password

Community
  • 1
  • 1
Packet Tracer
  • 3,884
  • 4
  • 26
  • 36
  • What I"m looking for is the actual command to set the priority of syslog-ng globally in either php or linux. – Mulvihic Jul 04 '14 at 10:18