Hidden Gems series - part 2

Issue 2, 2014

Download pdf

Logged fields for service auditing

Welcome to another Hidden Gem, where we will highlight a lesser-known valuable feature of the webMethods suite. There are many such hidden gems that you may not have stumbled upon in training or documentation but could make your life easier or your implementation even better. This edition’s hidden gem is logged fields for service auditing in Integration Server.
 

What is service auditing?
Service auditing in Integration Server allows you to easily capture details about service execution in the audit log database. The start and end time can be logged, and the pipeline can be included if required. Audit data can be viewed and searched in the My webMethods service monitoring portlets or queried using services in the WmMonitor package on Integration Server.

Until recently, service auditing was not widely used because it was not possible to capture business-relevant context data along with the audit records. Information, such as customer number, order number, transaction ID and department code, was buried in a large pipeline and impossible to query.

What are logged fields?
If you have used webMethods BPMS, you’re familiar with the Logged Fields tab available in Designer. It allows you to pick one or more fields from the process pipeline, give them meaningful names and have them logged in such a way that they can easily be used for finding process instances based on business-relevant data.

For service auditing, logged fields work in a very similar way. In Designer, there is a new tab in the service editor called “Logged Fields”. You can pick any fields from the service’s input or output pipeline. These are captured at run-time as name/value pairs in the audit database. A key benefit is that you do not need to log the entire pipeline to make use of logged fields.

How to use logged fields?
First, you need to enable auditing for your service. In the service properties panel, enable auditing (“Always” or when “Top Level Service Only”) and pick when to log your service ("Error only", "Error and success" or "Error, success and start") as shown in Figure 1. If required, choose to include the pipeline. This is required if you want to be able to resubmit the service but isn’t needed if you only want to capture the logged fields.


Figure 1: Setting the audit properties of a service

Next, in the Logged Fields tab as shown in Figure 2, select the fields you want logging. Only pick fields that you want to search. Be selective about the fields you pick. A large number of logged fields may affect run-time performance.


Figure 2: Picking the logged fields

After running the service a few times, you can search for and view the logged fields in My webMethods as shown in Figures 3 through 5.


Figure 3: Service monitoring in My webMethods



Figure 4: Searching for audit data using logged fields


Figure 5:  Logged fields in service audit details
 

Custom context ids
You can make it even easier to find audit records by assigning custom context IDs. You can assign a custom context ID at any point in a service by invoking the service pub.flow:setCustomContextID. Either map a useful value directly to the id field, or assign a compound value containing multiple relevant fields, such as in the example in Figure 6.


 

Figure 6: Assigning a custom context ID in Designer

Now, you can see the business relevant fields at a glance in the service audit list in My webMethods, and you can use the keyword search to find any substring in the context ID as shown in Figure 7.


Figure 7: Searching and viewing custom context ID in My webMethods

Don’t forget to enable audit logging in the service properties, as described above.

You can use any combination of logged fields and custom context IDs in the same service.

More information
Logged fields and custom context ID for service auditing are available in webMethods 8.2 and higher. You can find detailed documentation on these features in Designer Service Development Help available at the Software AG documentation website: techcommunity.softwareag.com/documentation

Let us know what you think of our new Hidden Gems series. And look out for another Hidden Gem in the next issue of TECHniques.