KHIKA Reports

From khika
Jump to navigation Jump to search

Introduction

Some reporting requirements demand processing of the indexed data further using some high level programming language. The processed output can then be stored again into the “_rpt” index and visualizations and dashboards can be created on it. Essentially, reports are the programs or scripts that take indexed data from KHIKA as input and further process it to generate desired output. They can be scheduled to run daily or weekly or at a custom time.

Typically, a Report searches for specific data already indexed in the system. Each report is meant for that specific purpose. It is associated with a specific “lucene” query and a program capable of processing the output of the lucene query. KHIKA runs the query associated with the Report at scheduled time to filter the data from indexed data and presents the output to the program/script associated with the Report on its “stdin” in the CSV format. The program written in a high level programming language can implement any complex logic to perform computations on this data and create meaningful output in the CSV format. The program must write its output on its “stdout”. KHIKA consumes this output and stores it back in the “_rpt” index.

The data from the “_rpt” index can be used for visualization and dashboards.

Go to Configure – Reports. Select the workspace from the workspace dropdown. You can see all the reports present in that workspace.


report1


Adding a Report

Please Note: If you have begun by installing an Application for this data type, (KHIKA Applications explained in section 3.1) then a set of inbuilt reports are pre configured as a part of the KHIKA application package.

To access Reports tab, from the left panel, click Configure and then click Reports tab. Select the workspace in which we have this data from the workspace dropdown on the top right. List of inbuilt reports for this data is displayed. We can schedule them, or see the history or manually run a report as explained in further sections.

However, to manually add a new report in addition to existing ones, click Add Report button as shown in the following screen:


report2


Following table lists the various fields in the Basic Configuration section of Add Report dialog box.


Details Description
Name Name of the report to be generated.
Description General description of the report.
Search/Filter Search query to filter data as per requirement.
Script Path of the report script.
Email Report To (optional) Email id to send the report.
Advanced Settings checkbox (optional but highly recommended) Click to go to the remaining tabs and add details.


SMTP Settings for KHIKA

One of the most used features of KHIKA Reports is that daily or weekly scheduled reports can be sent to respective relevant stakeholders by email. You must configure SMTP settings in KHIKA before sending reports by e-mails.

Configuring SMPT for sending e-mails in KHIKA Go to /opt/KHIKA/tserver/bin Open Cogniyug.properties file in your favorite editor and add following lines:

mail.smtpServer=192.168.1.100 #IP Address of the SMTP server mail.smtpPort=25 #default SMTP port is 25 mail.user=khika@khika.com #You must set an e-mail ID here to send the e-mails from) mail.useTLS=false #Set this to true if your SMTP server is configured with TLS)

  1. mail.password=enter clear text password here (if required) and uncomment by removing # sign
  2. mail.timeout=set timeout in seconds and uncomment by removing # sign
  3. mail.useSSL=false (set this to true if your SMTP server is configured with SSL)


Sample configuration mail.smtpServer=192.168.1.100 mail.smtpPort=25 mail.user=khika@khika.com mail.useTLS=false

  1. mail.password=
  2. mail.timeout=
  3. mail.useSSL=false

Save the file and restart KHIKA.

Click Basic Configuration tab and enter the values in each of the fields. Steps for adding values to Basic Configuration:

  1. Enter the Name of the report to be added.
  2. Enter general Description of the report.
  3. Enter a Search string (conforming to KHIKA query language).
  4. Enter the path of the report Script.
  5. Enter the Email id to send the report (if you have multiple e-mail recipients, separate the e-mail IDs with semicolon)
  6. Click Add. The details are added successfully.

First four fields are essential fields for a KHIKA report.

Basically, a KHIKA report consists of a “KHIKA Query” and a “Script/Program”. When you run a KHIKA report, you always supply a time range for which you want to run the report. KHIKA Reporting Engine spawns the Script/Program as a child process of KHIKA and simultaneously fires the “KHIKA Query” configured for the report to fetch all the data for the specified time range. KHIKA presents the data as input to the report Script/Program on its stdin in the form of CSV. The script/program must be capable of processing the CSV input received on stdin from KHIKA and produce the desired output post processing on stdout in the form of CSV. As KHIKA spawns the reporting Script/Program as a child process, it can easily communicate with it using simple “pipe based” inter process communication mechanism over stdin/stdout. This enables report developers to develop reports of any complexity using any programming language they are comfortable with. Most of the KHIKA reports shipped out-of-box are coded in python language. You are encouraged to study some of the reports stored in /opt/KHIKA/Apps/Dashboards_n_Reports directory. “KHIKA Query” for the report is nothing but a Lucene search string conforming to KHIKA Search Grammar explained in chapter “Working with KHIKA Search”

If you have selected “Advanced Setting”, you will presented a page to input further information for the reports.


report2