This page provides instructions on the correlation between Business Transaction requests and logs.
When investigating the cause of slowdowns/outages in your business applications, the problem does not always originate in the application code. Any additional information from application or machine logs can be helpful in your DevOps teams' investigation. One way to see supporting data that impacts the business transaction is to analyze logs for that transaction.
By configuring business transactions for GUID Injection, you can correlate logs to specific business transaction requests. This can be helpful when you see slow transactions and the call graph does not give you enough information to get to the root cause. You can use this feature to get the full context related to a failed or slow transaction.
Correlating specific instances of your business transactions to the related logs works by injecting the same requestGUID of the business transaction into the associated logs through our Java Agent. This helps you to quickly find the relevant logs from multiple tiers and nodes for a specific business transaction.
Visibility for this correlation requires both Transaction Analytics and Log Analytics licenses. See License Entitlements and Restrictions. |
This feature supports the following Java logging frameworks:
To enable transaction to log correlation, use the following steps. You must select the business transactions and specify the logging format.
Enter the pattern and the request GUID string. You can add the request GUID anyplace in the pattern. The request GUID must match the following exactly:
[%X{AD.requestGUID}] |
For example, the following screenshot shows the standard log4j pattern plus the request GUID:
Detail of Log4j example with the request GUID string:
[%d] [%-5p] [%t] [%c] [%X{AD.requestGUID}] %m%n |
Restart the affected application to enable the logger to pick up the new logging configuration.
If you have access to the source code for your application, you can also add the appender to the log4j.properties file directly. Here is an example of what that might look like with the request GUID in BOLD:
log4j.appender.order-file-appender=org.apache.log4j.FileAppender log4j.appender.order-file-appender.File=logs/telecom-order.log log4j.appender.order-file-appender.layout=org.apache.log4j.PatternLayout log4j.appender.order-file-appender.layout.ConversionPattern=[%d] [%-5p] [%t] [%c] [%X{AD.requestGUID}] %m%n log4j.logger.com.appdynamics.order=DEBUG, order-file-appender log4j.additivity.com.appdynamics.order=false |
To enable searching logs by request GUID and to view correlated logs and transaction data, use the following steps:
AD_REQUEST_GUID\[(?<requestGUID>.*)\]\]
.Once you have configured GUID injection, you can search the log files from a number of points in the Controller. Correlation only works when there are logs with the associated GUID in the given time range for an application where this feature is configured. The Search Logs By Request GUID button appears when there are logs for the snapshot request GUID in the snapshot time range.
From the log details in this example, you can see that the reason this transaction was slow is that the order processing queue was full and it took many retries before the order could complete.
You can select relevant transactions from any transaction analytics search and see details.
You can select a log from any log analytics search and see the Event Details.