Troubleshooting Tip: Resolving 'Query server internal error' in FortiSIEM Analytics UI
| Description | This article describes a scenario where FortiSIEM Analytics queries fail with the error “Query server internal error”, typically after an upgrade or when disk space on /opt is near capacity or exhausted. In these cases, queries executed directly in PostgreSQL continue to succeed, which indicates the issue is not database-related. This behavior is usually tied to the AppServer / Query service layer, where the system is unable to properly process or return query results. |
| Scope | FortiSIEM v7.x.x deployments. |
| Solution | Symptoms. Analytics queries in the UI return: Query server internal error.
PostgreSQL queries from the Supervisor still succeed:
psql phoenixdb phoenix -c "SELECT now();"
Example:
root@AH-SUPER ~] psql phoenixdb phoenix -c "SELECT now();"
This confirms the database is functioning correctly.
Check AppServer Logs. Run the following command to identify query-related errors in the AppServer logs:
grep --color=always -iH -C 5 "Query server internal error" /opt/glassfish/domains/domain1/logs/.log | less -R
Example output:
PH_APPSERVER_QUERY_RUN_ERROR ... Query server internal error
Review backend logs for query-related warnings:
grep --color -i phQuery /opt/phoenix/log/phoenix.log
Example:
Could not open dir /query/stopped
These messages indicate missing or inaccessible query working directories.
Root Cause. This issue is typically caused by inconsistencies on the AppServer side rather than a database failure.
Common causes include:
Even when query services are running and the database is healthy, the AppServer may still fail to execute queries properly if required directories or cache data are not in a valid state.
Solution.
ps -ef | grep phQuery
phQueryMaster.
mkdir -p /opt/phoenix/cache/query
Create the following directories if they do not exist:
mkdir -p /opt/phoenix/cache/parser/upload/evt mkdir -p /querywkr/stopped mkdir -p /query/active
chown -R admin:admin /opt/phoenix/cache/ chmod -R 775 /opt/phoenix/cache/parser/upload/
Machine learning cache cleanup. This issue has also been associated with the /opt/MachineLearning directory increasing in size, which can impact query performance and system behavior.
This was previously identified as a bug and has been addressed in: 7.1.4.
Root cause:
When to run this step:
Run the cleanup script.
/opt/phoenix/phscripts/bin/phMLCacheCleaner.py
After running the script, re-test Analytics queries.
Validation Steps:
Expected results:
|