Integrate application logs collector with Test Observability
Learn how you can push your server side application error logs and stacktraces to Test Observability.
Why should you integrate application logs collector?
Test Observability offers you a consolidated view of all different kinds of logs from different systems with a timeline debugging experience wherein you get to see the actual test failure and also see any other failure that might’ve occurred before the actual assertion failed.
The consolidated logs view can also include error/stacktraces from your backend staging application that is under test so that any logs generated at the application can be shown in context of a test case.
The example screenshot below shows the consolidated logs of a failed test case where the assertion error is visible and also the preceding error stacktrace that was generated at the backend staging application server:
Pre-requisites
- You should already have logging instrumentation enabled in your staging application server that is under test.
- The later parts of the document assumes that you’d have a
file.log
or an equivalent log file for each of the instances/microservices of your application from where you’d want to enable logging during testing.
Supported log collector integrations
We’re documenting the integration guides for the following logging services but you can make it work pretty much with any service that can send log lines to an API in a specific format.
Log upload through Filebeat and Logstash
Follow the steps below to upload your log files to Test Observability:
Install filebeat on your machine and add files listener
Install Filebeat (if not already installed) and run on any system/service which generates logs. Then you’d have to configure Filebeat as shown below:
Output of Filebeat is configured above to send the logs to a Logstash service running on localhost:5044. You’d have to configure it to the right URL where Logstash is running in your case.
On Logstash machine, install Logstash and Loki plugin
You’d have to install Logstash on a machine (if not already done) and thereafter install the Loki plugin as shown below:
Configure Logstash
You’d have to configure Logstash with a config file shown below. Please note the usage of output
configuration with url
for uploading the logs to Test Observability and the usage of username
and password
which should be the same as you’re using to run Test Observability.
Restart Logstash
Restart your Logstash for changes to take effect.
Log upload through Logstash
Install Logstash and Loki plugin
You’d have to install Logstash on a machine (if not already done) and thereafter install the Loki plugin as shown below:
Configure Logstash
You’d have to configure Logstash with a config file shown below. Please note the usage of output
configuration with url
for uploading the logs to Test Observability and the usage of username
and password
which should be the same as you’re using to run Test Observability.
Restart Logstash
Restart your Logstash for changes to take effect.
Log upload through promtail
Download and Install Promtail
You’d need to download and install Promtail if not already done.
Create Promtail config
You’d need to create a Promtail config file as shown below. You can also learn more about Promtail config files. Note the usage of clients
config. The url
used is the API endpoint of Test Observability where your logs would be uploaded and the username
and password
need to be the same as the one used to run Test Observability through the framework/language SDKs.
Run Promtail with config
You’d then need to run Promtail using the config as shown below:
Log upload through fluentD
Download Fluentd agent
You’d need to download and install Fluentd agent using one of the listed methods.
Create Fluentd config file
You’d then need to create a Fluentd config file as shown below:
Run Fluentd with config
You’d then need to run Fluentd using the config as shown below:
Limitations of application logs mapping to test cases
- We are capturing only the errors in your backend application logs. Info, debug or warning logs won’t be captured by Test Observability yet.
- We will be mapping errors or stacktraces seen in your application logs with test cases based on timestamp mapping since we do not have any request tracing implemented yet. Hence, it might so happen that if multiple tests are running in parallel and an exception occurs in your application, the same would be mapped to all such tests that were running at that point of time.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!