How to Remotely Tail DataPower Logs

You can use DPBuddy to tail and collect DataPower logs. DPBuddy comes with tailLog command that periodically polls DataPower and obtains and concatenates the latest log entries. Its usage is very similar to a regular "tail" command:

dpbuddy tailLog -f 

"tailLog" prints to stdout, so it can be combined with grep. "tailLog" is very useful during development or troubleshooting when there is a need to continuously monitor DataPower logs, it provides a convenient alternative to viewing/refreshing logs in WebGUI. By default, "tailLog" tails the "default-log" log target, your custom target can be specified using the "-logTarget" option.

"tailLog" can be used for automated monitoring of the logs. You can provide regexp error patterns using the "-failPatterns" option. If a pattern is found, "tailLog" will return a failure, e.g.:

tailLog -domain default -failPatterns "error"

You can set up an external scheduler to run the command at some interval and also send notifications. This can be easily accomplished with cron/bash, Jenkins or even Nagios (via a simple bash wrapper -- DPBuddy returns "12" in case of errors which would need to be translated into "1" or "2" to follow Nagios return code conventions). We also provide consulting services to help you integrate DPBuddy with various enterprise monitoring products, contact us if you're interested.

DPBuddy also generates audit log with a complete history of all the changes to DataPower, including affected configuration objects. This audit log is already in JSON format, so it is trivial to stream it to any log repository. The benefit of keeping DataPower logs and DPBuddy audit logs in the same place is the ability to correlate changes to the configuration with the potential issues arising from these changes. This is another reason why it is so important to define structured fields for DataPower configuration object names and types.

Finally, DPBuddy can also be used to download logs from DataPower for archiving purposes, e.g.:

dpbuddy download -toDir . -domain default -include "logstore:/mylog.*"

DPBuddy 3.4 can compare the timestamp of the log file and download it only if it's changed. Just use "-downloadIfChanged" option of the command.

Interested in automating DataPower log management? Download DPBuddy and give it a try or inquire about our consulting services.