Kaspersky Next XDR Expert

Executing an SQL query by using the klsql2 utility

This article describes how to use the klsql2 utility, and execute an SQL query by using this utility. Use klsql2 utility version that is included in your Open Single Management Platform version installed.

To use the klsql2 utility:

  1. Go to the directory where Administration Server is installed. The default installation path is /opt/kaspersky/ksc64/sbin.
  2. In this directory, create a blank file with the .sql extension.
  3. Open the created .sql file in any text editor.
  4. In the .sql file, type the SQL query that you want, and then save the file.
  5. On the device with Administration Server installed, in the command line, type the following command to execute the SQL query from the .sql file and save the results to the result.xml file:

    sudo ./klsql2 -i src.sql -u <username> -p <password> -o result.xml

    where <username> and <password> are credentials of the user account that has access to the database.

  6. If required, enter the login and password of the user account that has access to the database.
  7. Open the newly created result.xml files to view the SQL query results.

You can edit the .sql file and create any SQL query to the public views. Then, from the command line, execute your query and save the results to a file.

See also

Configuring event export to SIEM systems