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

Document PHP developer debugging / troubleshooting techniques #254

Open
chrisinmtown opened this issue Mar 25, 2021 · 2 comments
Open

Document PHP developer debugging / troubleshooting techniques #254

chrisinmtown opened this issue Mar 25, 2021 · 2 comments
Labels
T: enhancement Type: enhancement. This issue seeks an improvement of an existing feature

Comments

@chrisinmtown
Copy link
Contributor

chrisinmtown commented Mar 25, 2021

Document ways to see what the MISP PHP code is doing. All of the following require modifying php files:

(1) Change MISP server setting Security.debug from 0 to 1 or (caution) 2; then use function debug(). But as @iglocska points out, this will start pasting the debug messages directly in the pages you query and the API will include them too (be careful, the result will be invalid JSON for obvious reasons)

(2) Change MISP server setting Security.admin_debug from 0 to 1. But this is black magic to me and might be buggy, see MISP/MISP#7131

(3) Write information directly to a file with this function:

file_put_contents('/path/to/output/file', json_encode($myvar) . PHP_EOL, FILE_APPEND));

(4) Use PHP method like this:

CakeLog::write('debug', 'Got here');

as described here:

https://book.cakephp.org/2/en/development/debugging.html#using-logging-to-debug

CakeLog is enabled by the following statement in /var/www/MISP/app/Config/bootstrap.php; it's present in bootstrap.default.php in the tip of "main" branch, double-check your instance to be sure:

App::uses('CakeLog', 'Log');

Gitter discussion here:

https://gitter.im/MISP/Support?at=605c80ba9ebdfd1640998e56

@Wachizungu
Copy link
Contributor

Wachizungu commented Mar 25, 2021

You can enable MISP debug mode for site admins only (debug level will than be 1 for site admins unless the global level is 2). This prevents normal users having the debug styling in the GUI at the same time (can be useful for operational instances).

MISP/MISP@ab26eaf

@enjeck enjeck added the T: enhancement Type: enhancement. This issue seeks an improvement of an existing feature label Mar 25, 2021
@Wachizungu
Copy link
Contributor

For STIX ingestion errors:
/var/www/MISP/app/tmp/logs/exec-errors.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: enhancement Type: enhancement. This issue seeks an improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants