Thursday, May 21, 2015

NextReports Server: Connection Logging

Starting from NextReports 8.1 connection creation is written to log for debug purposes. By default all connections are written to connections.log found inside <server_install_folder>/logs folder. Default log level type is INFO

Inside <server_install_folder>/webapps/nextreports-server/WEB-INF/classes/log4j.properties user can change log level from INFO to DEBUG, to see information from the pool when a connection is created/used:

log4j.logger.ro.nextreports.server.util.ConnectionUtil=INFO, CONNECTION_FILE
log4j.additivity.ro.nextreports.server.util.ConnectionUtil=false

Users will be able to see on DEBUG level how many connections are in pool (min and max values), how many connection are active, idle or busy.

In case you experience some connections problems (like timeouts) and you are sure your database is up and running, you should put this log's level on DEBUG and start accumulating data to reproduce the problem again.

Tuesday, May 19, 2015

NextReports: Analysis versus Table Widgets

Even if a table widget inside a dashboard seems to be similar to an analysis table, there are many differences between them.

"Analysis" is a special object with following major differences than a widget table:
  • Analysis shows raw data (no patterns are used) and that makes the possibility to easily have sortable columns
  • Analysis can have a list of sortable columns (sort by column1, then column 2, ….)
  • Analysis persists sortable columns
  • Analysis has a lot of other features  like selection, grouping, filtering, pagination, freeze.
  • Analysis uses local data brought here by an ETL process
"Table Widget" has the following characteristics :
  • Table Widget has behind a report with a layout
  • Table widget may contain formatted data (if patterns are used like for dates, numbers,..)
  • The report behind a table widget may contain different type of values on same column (because report's layout can have more than one detail band). 
  • Table Widget may have a style (foreground and background colors)
From version 8.1 of NextReports Server :
  • Table widgets will have a header with sorting columns. 
  • Sorting is added only to those table widgets that contain only one detail band (the actual database columns). On all others table widgets sorting has no sense.
  • Sorting on table widgets is not persisted, so if you will leave dashboard and return or if you do a refresh the sorting will disappear. But if you sort, you are able (before refresh) to Save to Excel with the used sorting.

Thursday, May 14, 2015

NextReports: yAxis with 'starting from zero' property

From NextReport 8.1, Next Charts library will add a new property on yAxis called 'starting from zero'.

The minimum value on yAxis is computed so that all y values be some 'nice' numbers. This minimum value can be sometimes negative, sometimes 0 and sometimes positive. In case of positive numbers users may desire to start yAxis from zero  if computed minimum  value is bigger than zero.

Let's take following chart, for example, with values 44, 32, 34, 31. Computed min value is 30.


If users want to see the chart starting from zero, this is easily done by selecting 'starting from zero' property:


In this case computed min value is considered zero and the chart will look accordingly:


In case of negative values, this property has no effect.

Tuesday, May 05, 2015

NextReports Server: Internal Reports

Starting with NextReports 8.1 version a new section called Audit will be available.


Here, any administrator can obtain data from NextReports Server repository.

Just some examples of questions, users can get an easy answer:

What are the reports with write permission for group 'Test'?
What were the failed run reports yesterday?
What is the full list of Schedulers?

Users can sort the result and save it as an excel file.

Tuesday, April 28, 2015

NextReports Server: Audits at your hand

By default NextReports Server outputs some events to log files with following action names:
  • Sign in
  • Sign in failed
  • Sign out
  • Add entity
  • Modify entity
  • Delete entity
  • Copy entity
  • Move entity
  • Rename entity
  • Restore entity
  • Grant user / group
  • Revoke user / group
  • Run report
These events have some common properties like id, date, user name, action,session, ip, level (0=info, 1=error), error message. For some events there are also other properties. For example for "Run report" there are report path and duration; for "Grant user" there are entity path, user name to grant for, permissions and recursive flag.

NextReports Server has an extensible auditor feature. A database auditor can be defined to save all these events inside a database. This is very important because NextReports can generate reports over that database to get valuable information.

Inside securityContext.xml there is a bean called auditor:
 <bean class="ro.nextreports.server.audit.CompoundAuditor" id="auditor">
        <property name="auditors">
            <list>
                <ref bean="logAuditor"/>
            </list>
        </property>
</bean>
          

In this list, besides the log auditor we can add a database auditor:

<bean class="ro.nextreports.server.audit.CompoundAuditor" id="auditor">        
        <property name="auditors">             
           <list>
                 <ref bean="logAuditor"/>
                 <ref bean="dbAuditor"/> 
            </list>
        </property>
</bean>       
  
<bean class="ro.nextreports.server.audit.MySqlAuditor" id="dbAuditor">
         <property name="dataSource" ref="auditDataSource"/>
</bean>
   
<bean class="org.springframework.jdbc.datasource.DriverManagerDataSource" id="auditDataSource">
      <property name="driverClassName" value="com.mysql.jdbc.Driver"/>      
      <property name="url" value=""/>
      <property name="username" value=""/>
      <property name="password" value=""/>
</bean>

The database behind must contain two tables and a sequence:
  • NS_AUDIT (EVENT_ID, EVENT_DATE, EVENT_USERNAME, EVENT_ACTION, EVENT_SESSION, EVENT_IP, EVENT_LEVEL, EVENT_ERROR_MESSAGE)
  • NS_AUDIT_CONTEXT (EVENT_ID, EVENT_NAME, EVENT_VALUE)
  • NS_AUDIT_SEQ
As stated before, common properties will be saved inside NS_AUDIT, while specific event properties will be saved inside NS_AUDIT_CONTEXT.

For example, for a MySql database we need to call following sqls to initialize:

CREATE TABLE NS_AUDIT (
  EVENT_ID INT UNSIGNED NOT NULL, 
  EVENT_DATE TIMESTAMP, 
  EVENT_USERNAME VARCHAR(50), 
  EVENT_ACTION VARCHAR(30),
  EVENT_SESSION VARCHAR(100), 
  EVENT_IP VARCHAR(20), 
  EVENT_LEVEL  INT(2) , 
  EVENT_ERROR_MESSAGE VARCHAR(150)
) 

CREATE TABLE NS_AUDIT_CONTEXT (
  EVENT_ID INT UNSIGNED, 
  EVENT_NAME VARCHAR(50), 
  EVENT_VALUE VARCHAR(200)
) 
 
CREATE TABLE NS_AUDIT_SEQ( 
  EVENT_ID INT UNSIGNED  NOT NULL,
  CONSTRAINT event_pk PRIMARY KEY (EVENT_ID)
)

INSERT INTO NS_AUDIT_SEQ (EVENT_ID) VALUES(0) 

You should also create an index on EVENT_ID column from NS_AUDIT.