Install and Configure Kuda
Install
Install the Kuda by adding the following dependency:
<dependency>
<groupId>com.n1netails</groupId>
<artifactId>n1netails-kuda</artifactId>
<version>0.3.3</version>
</dependency>
Gradle
dependencies {
implementation 'com.n1netails:n1netails-kuda:0.3.3'
}
Configure
Requirements
Set up and have the n1netails-api running on your server.
- N1netails-Api README
In order to get started with Kuda all you need to do is add the following three lines of code.
// your n1netails-api location. For localhost use http://localhost:9901
TailConfig.setApiUrl("https://app.n1netails.com");
// your n1ne token (created by the n1netails user interface or api)
TailConfig.setN1neToken("n1_n1ne-token");
// send your first tail
Tail.error("Testing kuda error").withTag("env", "prod").send();
⚠️ Note: If you do not configure the TailConfig then Kuda will log a single warning about missing configurations and default to simple logging.
TailConfig
Example of using TailConfig to set the N1ne token, API url and path.
import com.n1netails.n1netails.kuda.internal.TailConfig;
public class ExampleService {
public ExampleService() {
// You can configure this anywhere must be set once.
TailConfig.setApiUrl("https://app.n1netails.com");
// (Optional) set a custom path to send the alerts. If not set it will default to `/ninetails/alert`
TailConfig.setApiPath("/ninetails/alert");
// Set the n1ne token value generated by n1netails api (The token presented below is just an example.) If you are using n1netails-kuda for your own alerting api this value is optional.
TailConfig.setN1neToken("n1_c7PNos3Nru2NLxVA6ANBbbJZsuJ5g8RVzZJhBpQjz5Hz7qrUB5yloRKjouRU9yzzGpbLhuZAS_ga0HQ_a7dLOQ");
}
}