mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
Load index template resource using ESExporter.class rather than the ES utility method
Closes #149
This commit is contained in:
parent
8c74589245
commit
ead75e2be0
1 changed files with 6 additions and 5 deletions
|
@ -48,10 +48,7 @@ import org.elasticsearch.marvel.agent.Utils;
|
|||
import org.elasticsearch.marvel.agent.event.Event;
|
||||
import org.elasticsearch.node.settings.NodeSettingsService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
|
@ -398,7 +395,11 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
|
|||
private boolean checkAndUploadIndexTemplate() {
|
||||
byte[] template;
|
||||
try {
|
||||
template = Streams.copyToBytesFromClasspath("/marvel_index_template.json");
|
||||
InputStream is = ESExporter.class.getResourceAsStream("/marvel_index_template.json");
|
||||
if (is == null) {
|
||||
throw new FileNotFoundException("Resource [/marvel_index_template.json] not found in classpath");
|
||||
}
|
||||
template = Streams.copyToByteArray(is);
|
||||
} catch (IOException e) {
|
||||
// throwing an exception to stop exporting process - we don't want to send data unless
|
||||
// we put in the template for it.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue