Logging Service

The Logging Service aims to centralize logs, and offer an interface for consulting and monitoring log applications. It functionalities are exposed as web service and can be deployed in an IOD environment.

The project contains the following parts:

Logging web Service

Description

The logging web service is a module integrated into Stardust application as a plug-in containing web page and exposed web service.

Web Page

Figure: Web Page

URL

WSDL in IOD: https://www.infinity.com/iod1/a/5a666f90-2d2f-469f-b3ef-38b54eba0986/services/soap/LoggingServiceHttpBasicAuth?wsdl

Service API

MethodParametersResult
addLogEntryLogEntry logEntryVoid
addLogEntryListList logEntryListVoid
findLogEntries
  • Date from
  • Date to
  • String businessUuid
  • String systemUuid
  • String systemName
  • String serviceName
  • String tagName
  • String tagValue
  • String level
  • String message
List logEntry

Log structure

AttributeTypeDescription
systemGuidStringThe system guid
systemNameStringThe system name
timestampDateDate of the log entry
hierarchyIndicatorInt The log tree is composed by three levels :
  • LOG.IN : open new log entry
  • LOG.CHECK : check box for a log entry
  • LOG.OUT : close a log entry
In a list of logs, logs are inserted in a defined hierarchical levels
  • A level is opened by a LOG.IN and closed by LOG.OUT and may contain sub levels
  • Each LOG.IN must have a corresponding LOG.OUT
businessCaseGuidStringThe business case guid
drillDownUriStringURI
tagsMapEach log entry may accept a non determinate number of tags (key/value), which can be visualized when pointing the document icon.
durationStringThe duration column is calculated based on the time between LogEntry.IN and LogEntry.OUT
MessageStringThe log message
LevelEnumeration The log level can Be
  • INFO
  • ERROR
  • WARN
  • FATAL
  • DEBUG

Web service client

Description

The ws client contains 2 packages, one contains web service and its configuration like wsdl location and jaxb object, and the other contain a Junit class to show developer how to use web service.

Calling logging WS from camel route

The following example shows how to call the logging web service through camel route. A JMS message is intercept in the queue and a camel interceptor will route the message and call the logging web service through callLoggingWS (call the web service and log into the application).

                from("activemq:queue:test.queue").convertBodyTo(String.class).process(new Processor() {
                    public void process(Exchange e) {
                        LoggingServiceClient logServiceClient = new LoggingServiceClient();
                        logServiceClient.callLoggingWS(e.getIn().getBody());
                    }
            

The message describing the log is based on csv notation as following: SystemGuid,SystemName,ServiceName,Timestamp,HierarchyIndicator,BusinessCaseGuid,DrillDownUri,message,level,key_1=value_1,...,key_n=value_n

Example

31babc6e-5be9-452d-817d-9cf03aa16997,IPP,Process C,1315663200000,1,d2496f47-f8e7-4ce4-b61d-3d0868d4a49b10,http://localhost:8080/bla,trade=4711,counterparty=Bla

Client interceptor for Stardust

Description

The client interceptor for Stardust is an Event Handler which uploads logs via the Logging web service. The camel route intercepts the message from an endpoint (file, jms, etc.) and routes it to the LoggingProcess using Camel IPPConnector. The content of the message is passed to the process, the process will parse the message and call the logging web service using the addLogEntry method.

Logging Process

Figure: Logging Process

The logging process

The following figure represents the logging process history

Process History

Figure: Process History

The camel route

<route>
<from uri="file://C:/temp/incomingLogs?delete=true" />
<setHeader headerName="ippProcessId">
<constant>LoggingProcess</constant>
</setHeader>
<setHeader headerName="ippUser">
<constant>motu</constant>
</setHeader>
<setHeader headerName="ippPassword">
<constant>motu</constant>
</setHeader>
<convertBodyTo type="java.lang.String" />
<to uri="ipp:authenticate:setCurrent"/>
<to uri="ipp:process:start?data=LogContents::${body}" />
</route>

Logs persistence

Logs are being persisted into a database in the following table.

-- Create table
create table LOG_SERVICE_ENTRIES
(
  SYSTEM_NAME        varchar2(2000),
  SERVICE_NAME       varchar2(2000),
  SYSTEM_GUID        varchar2(2000),
  BUSINESS_CASE_GUID varchar2(2000),
  DRILL_DOWN_URI     varchar2(2000),
  TAGS               varchar2(2000),
  HIERARCHYINDICATOR number,
  LOG_DATE           timestamp(6),
  LEVEL              varchar2(10),
  MESSAGE            varchar2(4000)
)

LOG SERVICE ENTRIES

Figure: Log Service entries

Log Search

The search can be performed by start time, end time, business Case Guid, Tag name and Tag value, and ability to search with any number of parameters.

Example of search by start time, end time, business Case Guid :

Search screen

Figure: Search screen

Calculating logs duration

The log duration is calculated based on the time between LogEntry.IN and LogEntry.OUT. The duration is displayed in this format hh:mm:ss:SSS

Calculate duration

Figure: Calculate duration

Data masking and encryption

The following example shows how some data are masked when displaying the LogEntries in the table:

In the following example we are masking the social security number (ssn) tag.

Mask Some Tag

Figure: Mask Some Tag

Log Service Statistics screen

Example

The log statistics screens shows the occurrence number for a logEntry defined by "systemName" and "serviceName".

In the figure below, logs generated by System B/Service W occurred 3 times.

Log Statistics screen

Figure: Log statistics screen

Log Occurence Screen

The occurrence number is a link, once clicked we get all logEntries having (system B, Service W), see following screen.

Log search screen

Figure: Log search screen

Log Repair

The application offers the user the possibility to repair a Log list in case a log.IN or log.OUT is missing. The added logs can be persisted.

Knowing that the logs are grouped by bloc and each bloc have a Log.IN and a Log.OUT, the problem that can occure during application crash is that a Log will lose it's Log.IN or Log.OUT.

So : In order to repair, user has to select the broken Log and choose which type of log (IN or OUT) to insert.

Example : repairing a Log.OUT by adding a Log.IN to the log unit

Step 1 : locate the desired log to repair

As we can see in the figure below, the Log defined by (System D1, Service Z1) has a missing Log.IN

log repair initially

Figure:Log repair initial screen

Step 2 : Choose the log type to add

To repair this log, user has to click on repair icon that will display a popup panel asking user to choose the log type to insert.

adding log.in

Figure: log adding log.in

Step 3 : Log has been added and aibility to delete it

Once the user has validated his request, the application update the log tree by adding an internal log. This log, as show in the figure "log.in added" has an icon (delete), this will offer the possibility to the user to delete it.

We can notice that the added log is displayed as a parent of the repaired log

log.in added

Figure:log.in added

Step 4 : Persisting the added log

After repairing the log tree, the user has the ability to persist the new logs, to do so, user has to click on persist Internal Logs button.

persisting log

Figure:Persisting logs

Once persisted, the log's delete icon is removed.

Note

In the previouse example we have corrected the unit log by adding a Log.in, by the same way we can correct an unit log missing a Log.out

User can repair multiple log in same time and can persiste more than one log in one operation.

Message Tooltip

The message column in the data table has a maximun size (N), once it is exceeded the N characters are append by "..." and a tooltip is available to show the entire message.

message tooltip

Figure:message tooltip

Using Logging Service with Log4j and MDC

The logging service offers the ability to any client to use log4j or slf4j, by including the infinity WebService Appender. This appender allows the communication between any client using log4j and the logging service.

Using Log4j/slf4j for logging

How to configure and use Log4J property file to benefit from ipp logging service and initializing the Service parameters (systemName, serviceName and businessCaseGuid):

log4j.rootCategory = INFO, default, console, WS
....
#Infinity web service appender
log4j.appender.WS=com.infinity.log4j.databaseappender.WSAppender

#Declaring systemName,serviceName and businessCaseGuid parameters.
log4j.appender.WS.systemName=SystNameFromLog4j
log4j.appender.WS.serviceName=ServiceLog4j
log4j.appender.WS.businessCaseGuid=abc-Log4j-java-client
Using Log4j/slf4j and MDC for logging

Other than using properties files to initialize service parameters, the web Service Appender support the use of MDC to dynamically initialize the SystemName, ServiceName and the guid from any java client.

MDC.put("systemName","IPP");
MDC.put("serviceName","Service Name");
MDC.put("businessCaseGuid","abc-xyz-java-client");
Note

If the client does not use MDC to override the parameters defined in log4j properties file, the logging service will use the values as defined in the Log4J.properties.

Purge Logs

The service offers user the aiblility to purge logs, by choosing the date, all logs till the choosed date will be removed.

Logs Purge

Figure:Logs Purge

Deployment of the new module in IOD

The service is successfully deployed in IOD and the plugin and WS are accessible through this URL

Plug-in: https://www.infinity.com/iod1/a/5a666f90-2d2f-469f-b3ef-38b54eba0986/plugins/common/main.iface

WSDL: https://www.infinity.com/iod1/a/5a666f90-2d2f-469f-b3ef-38b54eba0986/services/soap/LoggingServiceHttpBasicAuth?wsdl