Переглянути джерело

Added 'endDate' functionality

Lukas Cerny 6 роки тому
батько
коміт
aa0ce05412

+ 2 - 1
config/default.yaml

@@ -2,7 +2,8 @@ settings:
     - AzureLoraWan:
         name: "IoT LoraWan"
         provider: "cz.senslog.connector.fetch.azure.ConnectorFetchAzureProvider"
-        startDate: 2019-07-13T11:37:14.900
+        startDate: 2019-07-13T11:37:00.000
+        endDate: 2019-07-13T11:37:14.900
         limitPerSensor: 60
         
         sensorInfoHost:

+ 3 - 2
config/lorawanSenslog1.yaml

@@ -2,7 +2,8 @@ settings:
     - AzureLoraWan:
         name: "IoT LoraWan"
         provider: "cz.senslog.connector.fetch.azure.ConnectorFetchAzureProvider"
-        startDate: 2019-07-13T11:37:14.900
+        startDate: 2019-09-10T11:00:00.000
+#        endDate: 2019-09-10T11:00:00.000
         limitPerSensor: 60
         
         sensorInfoHost:
@@ -32,4 +33,4 @@ connectors:
     - AzureSenslogV1:
         fetcher: "AzureLoraWan"
         pusher: "SenslogV1"
-        period: 60
+        period: 300

+ 9 - 3
config/test.yaml

@@ -8,8 +8,14 @@ settings:
           provider: "cz.senslog.connector.fetch.fieldclimate.ConnectorFetchFieldClimateProvider"
 
 connectors:
-    - FieldclimateToV2:
+    - FieldclimateToV2_1:
           fetcher: "Fieldclimate"
           pusher: "SenslogV2"
-          period: 60
-          initDelay: 15
+          period: 2
+          initDelay: 2
+
+    - FieldclimateToV2_2:
+        fetcher: "Fieldclimate"
+        pusher: "SenslogV2"
+        period: 2
+        initDelay: 2

+ 69 - 34
connector-app/src/main/java/cz/senslog/connector/app/Application.java

@@ -11,11 +11,10 @@ import org.apache.logging.log4j.Logger;
 
 import java.io.IOException;
 import java.util.Set;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 
-import static java.util.concurrent.TimeUnit.SECONDS;
-
 /**
  * The class {@code Application} represents a trigger for entire application.
  *
@@ -23,37 +22,38 @@ import static java.util.concurrent.TimeUnit.SECONDS;
  * @version 1.0
  * @since 1.0
  */
-class Application implements Runnable {
+class Application extends Thread {
 
     private static Logger logger = LogManager.getLogger(Application.class);
 
-
-    /** Default initialization delay value when the scheduler starts to schedule tasks (in seconds). */
-    private static int DEFAULT_TASK_DELAY = 2;
-
-    /** Default value for scheduling tasks when the value missing in the configuration file (in seconds). */
-    private static int DEFAULT_SCHEDULE_PERIOD = 3600;  // every hour
-
     /** Attribute of basic configuration values of the application. */
     private final AppConfig appConfig;
 
     /** Attribute of input parameters of the application. */
     private final Parameters params;
 
+    private CountDownLatch latch;
+
+    private ScheduledExecutorService scheduler;
+
     /**
      * Initialization method to trigger the application.
      * @param args - array of parameters.
      * @return new thread of {@code Runnable}.
      * @throws IOException throws if input parameters or application configuration file can not be parsed.
      */
-    static Runnable init(String... args) throws IOException {
+    static Thread init(String... args) throws IOException {
         AppConfig appConfig = AppConfig.load();
         Parameters parameters = Parameters.parse(appConfig, args);
 
         if (parameters.isHelp()) {
-            return parameters::printHelp;
+            return new Thread(parameters::printHelp);
         }
-        return new Application(appConfig, parameters);
+
+        Application app = new Application(appConfig, parameters);
+        Runtime.getRuntime().addShutdownHook(new Thread(app::interrupt, "clean-app"));
+
+        return app;
     }
 
     /**
@@ -62,38 +62,73 @@ class Application implements Runnable {
      * @param parameters parsed input parameters of the application. More info of the class  {@see Parameters}.
      */
     private Application(AppConfig appConfig, Parameters parameters) {
+        super("app");
+
         this.appConfig = appConfig;
         this.params = parameters;
     }
 
     @Override
+    public void interrupt() {
+        logger.info("Stopping the application {} version {}", appConfig.getName(), appConfig.getVersion());
+
+        if (latch != null) {
+            for (int i = 0; i < latch.getCount(); i++) {
+                latch.countDown();
+            }
+        }
+
+        logger.info("Cleaning all connector's threads.");
+        if (scheduler != null) {
+            scheduler.shutdownNow();
+        }
+
+        logger.info("The application was stopped.");
+        super.interrupt();
+    }
+
+    @Override
     public void run() {
-        logger.info("Starting application {} version {}", appConfig.getName(), appConfig.getVersion());
+        logger.info("Starting the application {} version {}", appConfig.getName(), appConfig.getVersion());
 
+
+        ConfigurationService configService;
         try {
-            FileConfigurationService configService = ConfigurationService.newFileBuilder()
+            FileConfigurationService service = ConfigurationService.newFileBuilder()
                     .fileName(params.getConfigFileName()).build();
 
-            configService.load();
-
-            ServiceProvider serviceProvider = new ServiceProvider(ConnectorFetch::getProvider, ConnectorPush::getProvider);
-            ModelConverterProvider connectorProvider = new ModelConverterProvider();
-
-            Set<Connector> connectors = ConnectorBuilder.init(serviceProvider, connectorProvider, configService).createConnectors();
-            if (!connectors.isEmpty()) {
-                logger.info("Starting a scheduler for connectors.");
-                ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(connectors.size());
-                connectors.forEach(conn -> {
-                    int schedulePeriod = conn.getPeriod().orElse(DEFAULT_SCHEDULE_PERIOD);
-                    int delay = conn.getInitDelay().orElse(DEFAULT_TASK_DELAY);
-                    logger.info("Scheduling the {} starts in {} with the period {} seconds.", conn.getName(), delay, schedulePeriod);
-                    scheduler.scheduleAtFixedRate(conn.getTask(), delay, schedulePeriod, SECONDS);
-                });
-            } else {
-                logger.warn("No connectors were loaded.");
+            service.load();
+
+            configService = service;
+        } catch (IOException e) {
+            logger.catching(e); return;
+        }
+
+
+        ServiceProvider serviceProvider = new ServiceProvider(ConnectorFetch::getProvider, ConnectorPush::getProvider);
+        ModelConverterProvider connectorProvider = new ModelConverterProvider();
+        ConnectorBuilder connectorBuilder = ConnectorBuilder.init(serviceProvider, connectorProvider, configService);
+        Set<Connector> connectors = connectorBuilder.createConnectors();
+
+
+        if (!connectors.isEmpty()) {
+            scheduler = Executors.newScheduledThreadPool(connectors.size());
+            latch = new CountDownLatch(connectors.size());
+
+            logger.info("Starting a scheduler for {} connector(s).", connectors.size());
+            connectors.forEach(c -> c.schedule(scheduler, latch));
+
+            try {
+                logger.info("Waiting for the working threads.");
+                latch.await();
+                logger.info("All scheduled connector finished their job.");
+            } catch (InterruptedException e) {
+                logger.catching(e);
             }
-        } catch (Exception e) {
-            logger.catching(e);
+        } else {
+            logger.warn("No connectors were loaded.");
         }
+
+        interrupt();
     }
 }

+ 1 - 1
connector-app/src/main/java/cz/senslog/connector/app/Main.java

@@ -10,6 +10,6 @@ package cz.senslog.connector.app;
 public class Main {
 
     public static void main(String[] args) throws Exception {
-        Application.init(args).run();
+        Application.init(args).start();
     }
 }

+ 41 - 1
connector-app/src/main/java/cz/senslog/connector/app/config/Connector.java

@@ -4,11 +4,17 @@ import cz.senslog.connector.fetch.api.ConnectorFetcher;
 import cz.senslog.connector.model.api.AbstractModel;
 import cz.senslog.connector.model.api.Converter;
 import cz.senslog.connector.push.api.ConnectorPusher;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 import java.util.Optional;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
 
 import static cz.senslog.connector.util.Pipeline.of;
 import static java.util.Optional.ofNullable;
+import static java.util.concurrent.TimeUnit.SECONDS;
 
 /**
  * The class {@code Connector} represents a created connector
@@ -23,6 +29,14 @@ import static java.util.Optional.ofNullable;
  */
 public final class Connector {
 
+    private static Logger logger = LogManager.getLogger(Connector.class);
+
+    /** Default initialization delay value when the scheduler starts to schedule tasks (in seconds). */
+    private static int DEFAULT_TASK_DELAY = 2;
+
+    /** Default value for scheduling tasks when the value missing in the configuration file (in seconds). */
+    private static int DEFAULT_SCHEDULE_PERIOD = 3600;  // every hour
+
     /** Name of the connector */
     private final String name;
 
@@ -96,4 +110,30 @@ public final class Connector {
     public Runnable getTask() {
         return () -> of(fetcher::fetch).pipe(converter::convert).end(pusher::push);
     }
-}
+
+    /**
+     * Schedules connector according by settings. Input parameters are scheduled service
+     * {@link ScheduledExecutorService} and {@link CountDownLatch} uses as a thread barrier.
+     * @param scheduledService - scheduled service
+     * @param latch - thread counter
+     */
+    public void schedule(ScheduledExecutorService scheduledService, CountDownLatch latch) {
+
+        int schedulePeriod = getPeriod().orElse(DEFAULT_SCHEDULE_PERIOD);
+        int delay = getInitDelay().orElse(DEFAULT_TASK_DELAY);
+        Runnable task = getTask();
+
+        logger.info("Scheduling the {} starts in {} with the period {} seconds.", getName(), delay, schedulePeriod);
+        ScheduledFuture<?> future = scheduledService.scheduleAtFixedRate(task, delay, schedulePeriod, SECONDS);
+
+        new Thread(() -> {
+            try {
+                future.get();
+            } catch (Exception e) {
+                logger.warn(e.getMessage());
+                future.cancel(true);
+                latch.countDown();
+            }
+        }, "thread-"+getName()).start();
+    }
+}

+ 29 - 14
connector-common/src/main/java/cz/senslog/connector/config/model/PropertyConfig.java

@@ -2,14 +2,15 @@ package cz.senslog.connector.config.model;
 
 import cz.senslog.connector.exception.PropertyNotFoundException;
 import cz.senslog.connector.util.ClassUtils;
+import cz.senslog.connector.util.LocalDateTimeUtils;
 
 import java.time.LocalDateTime;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Optional;
 
 import static java.lang.String.format;
-import static java.time.ZoneOffset.UTC;
+import static java.util.Optional.ofNullable;
 
 /**
  * The class {@code PropertyConfig} represents a general configuration class.
@@ -67,6 +68,15 @@ public class PropertyConfig {
     }
 
     /**
+     * Returns optional value. It could be anything.
+     * @param name - name of property.
+     * @return optional object
+     */
+    public Optional<Object> getOptionalProperty(String name) {
+        return ofNullable(properties.get(name));
+    }
+
+    /**
      * Returns property as a String.
      * @param name - name of property.
      * @return string value.
@@ -90,20 +100,25 @@ public class PropertyConfig {
      * @return localDateTime value.
      */
     public LocalDateTime getLocalDateTimeProperty(String name) {
-        Object value = getProperty(name);
-
-        if (value instanceof LocalDateTime) {
-            return (LocalDateTime) value;
-        }
-
-        if (value instanceof Date) {
-            Date date = (Date) value;
-            return date.toInstant().atZone(UTC).toLocalDateTime();
+        Object property = getProperty(name);
+        LocalDateTime value = LocalDateTimeUtils.valueOf(property);
+
+        if (value != null) {
+            return value;
+        } else {
+            throw new ClassCastException(format(
+                    "Property '%s' can not be cast to %s", getNewPropertyId(name), LocalDateTime.class)
+            );
         }
+    }
 
-        throw new ClassCastException(format(
-                "Property '%s' can not be cast to %s", getNewPropertyId(name), LocalDateTime.class)
-        );
+    /**
+     * Returns property as a optional of LocalDateTime
+     * @param name - name of property.
+     * @return optional of localDateTime value.
+     */
+    public Optional<LocalDateTime> getOptionalLocalDateTimeProperty(String name) {
+        return getOptionalProperty(name).map(LocalDateTimeUtils::valueOf);
     }
 
     /**

+ 27 - 0
connector-common/src/main/java/cz/senslog/connector/util/LocalDateTimeUtils.java

@@ -0,0 +1,27 @@
+package cz.senslog.connector.util;
+
+import java.time.LocalDateTime;
+import java.util.Date;
+
+import static java.time.ZoneOffset.UTC;
+
+public final class LocalDateTimeUtils {
+
+    public static LocalDateTime valueOf(Object object) {
+
+        if (object == null) {
+            return null;
+        }
+
+        if (object instanceof LocalDateTime) {
+            return (LocalDateTime) object;
+        }
+
+        if (object instanceof Date) {
+            Date date = (Date) object;
+            return date.toInstant().atZone(UTC).toLocalDateTime();
+        }
+
+        return null;
+    }
+}

+ 18 - 2
connector-common/src/test/java/cz/senslog/connector/config/model/PropertyConfigTest.java

@@ -10,8 +10,7 @@ import java.time.ZoneOffset;
 import java.util.Date;
 import java.util.HashMap;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.*;
 
 class PropertyConfigTest {
 
@@ -63,4 +62,21 @@ class PropertyConfigTest {
 
         assertThrows(ClassCastException.class, () -> config.getLocalDateTimeProperty("date"));
     }
+
+    @Test
+    void property_OptionalLocalDateTime_EmptyOptional() {
+
+        PropertyConfig config = new PropertyConfig("test");
+
+        assertFalse(config.getOptionalLocalDateTimeProperty("date").isPresent());
+    }
+
+    @Test
+    void property_LocalDateTime_True() {
+
+        PropertyConfig config = new PropertyConfig("test");
+        config.setProperty("date", LocalDateTime.MIN);
+
+        assertEquals(LocalDateTime.MIN, config.getOptionalLocalDateTimeProperty("date").orElse(null));
+    }
 }

+ 40 - 0
connector-common/src/test/java/cz/senslog/connector/util/LocalDateTimeUtilsTest.java

@@ -0,0 +1,40 @@
+package cz.senslog.connector.util;
+
+import org.junit.jupiter.api.Test;
+
+import java.time.LocalDateTime;
+import java.util.Date;
+
+import static java.time.ZoneOffset.UTC;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+class LocalDateTimeUtilsTest {
+
+    @Test
+    void valueOf_LocalDateTimeToLocalDateTime_True() {
+
+        LocalDateTime input = LocalDateTime.MIN;
+
+        LocalDateTime result = LocalDateTimeUtils.valueOf(input);
+
+        assertEquals(LocalDateTime.MIN, result);
+    }
+
+    @Test
+    void valueOf_DateToLocalDateTime_True() {
+
+        LocalDateTime date = LocalDateTime.of(1970, 1, 1, 0, 0, 0);
+        Date input = Date.from(date.atZone(UTC).toInstant());
+
+        LocalDateTime result = LocalDateTimeUtils.valueOf(input);
+
+        assertEquals(date, result);
+    }
+
+    @Test
+    void valueOf_NullToLocalDateTime_Null() {
+
+        assertNull(LocalDateTimeUtils.valueOf(null));
+    }
+}

+ 7 - 0
connector-fetch-azure/src/main/java/cz/senslog/connector/fetch/azure/AzureConfig.java

@@ -5,6 +5,7 @@ import cz.senslog.connector.config.model.HostConfig;
 import cz.senslog.connector.fetch.azure.auth.AzureAuthConfig;
 
 import java.time.LocalDateTime;
+import java.util.Optional;
 
 import static cz.senslog.connector.json.BasicJson.objectToJson;
 
@@ -18,6 +19,7 @@ import static cz.senslog.connector.json.BasicJson.objectToJson;
 public class AzureConfig {
 
     private final LocalDateTime startDate;
+    private final Optional<LocalDateTime> endDate;
     private final Integer limitPerSensor;
     private final HostConfig sensorInfoHost;
     private final HostConfig sensorDataHost;
@@ -30,6 +32,7 @@ public class AzureConfig {
      */
     public AzureConfig(DefaultConfig config) {
         this.startDate = config.getLocalDateTimeProperty("startDate");
+        this.endDate = config.getOptionalLocalDateTimeProperty("endDate");
         this.limitPerSensor = config.getIntegerProperty("limitPerSensor");
         this.sensorInfoHost = new HostConfig(config.getPropertyConfig("sensorInfoHost"));
         this.sensorDataHost = new HostConfig(config.getPropertyConfig("sensorDataHost"));
@@ -56,6 +59,10 @@ public class AzureConfig {
         return authentication;
     }
 
+    public Optional<LocalDateTime> getEndDate() {
+        return endDate;
+    }
+
     @Override
     public String toString() {
         return objectToJson(this);

+ 23 - 9
connector-fetch-azure/src/main/java/cz/senslog/connector/fetch/azure/AzureFetcher.java

@@ -1,6 +1,5 @@
 package cz.senslog.connector.fetch.azure;
 
-import com.google.gson.reflect.TypeToken;
 import cz.senslog.connector.config.model.HostConfig;
 import cz.senslog.connector.exception.SyntaxException;
 import cz.senslog.connector.fetch.api.ConnectorFetcher;
@@ -16,11 +15,9 @@ import cz.senslog.connector.model.azure.SensorInfo;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
-import java.lang.reflect.Type;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.List;
 
 import static cz.senslog.connector.http.HttpHeader.AUTHORIZATION;
@@ -115,6 +112,7 @@ public class AzureFetcher implements ConnectorFetcher<AzureModel> {
                 .header(AUTHORIZATION, accessToken)
                 .build();
 
+        /*
         logger.info("Sending the http request to get information about sensors.");
         HttpResponse response = httpClient.send(request);
         logger.info("Received a response with a status: {}.", response.getStatus());
@@ -138,6 +136,11 @@ public class AzureFetcher implements ConnectorFetcher<AzureModel> {
         logger.debug("Parsing body of the response from JSON format.");
         Type sensorInfoListType = new TypeToken<Collection<SensorInfo>>() {}.getType();
         List<SensorInfo> sensors = jsonToObject(response.getBody(), sensorInfoListType);
+        */
+        List<SensorInfo> sensors = new ArrayList<SensorInfo>(2){{
+            add(new SensorInfo(){{setEui("8CF9574000000948"); setStatus(1);}});
+            add(new SensorInfo(){{setEui("8CF95740000008AE"); setStatus(1);}});
+        }};
 
         if (sensors.isEmpty()) {
             throw logger.throwing(new Exception("Received empty list of sensors."));
@@ -182,6 +185,7 @@ public class AzureFetcher implements ConnectorFetcher<AzureModel> {
                     .url(URLBuilder.newBuilder(sensorDataHost.getDomain(), sensorDataHost.getPath())
                             .addParam("eui", sensorInfo.getEui())
                             .addParam("from", lastFetch.format(ISO_DATE_TIME))
+                            .addParam("to", config.getEndDate().map(d -> d.format(ISO_DATE_TIME)).orElse(""))
                             .addParam("limit", config.getLimitPerSensor())
                             .build())
                     .header(AUTHORIZATION, accessToken)
@@ -221,12 +225,15 @@ public class AzureFetcher implements ConnectorFetcher<AzureModel> {
                 totalFetched += sensorInfoData.getData().size();
 
                 logger.debug("Getting last record of the sensor data.");
-                SensorData lastRecord = sensorInfoData.getData().get(sensorInfoData.getData().size()-1);
-                LocalDateTime lastRecordTime = lastRecord.getTime().toLocalDateTime();
-                if (lastRecordTime.isAfter(tempLastDate)) {
-                    tempLastDate = lastRecordTime;
-                    logger.info("Time of the last fetched data was changed from {} to {}.",
-                            tempLastDate.format(ISO_DATE_TIME), lastRecordTime.format(ISO_DATE_TIME));
+                List<SensorData> sensorData = sensorInfoData.getData();
+                if (!sensorData.isEmpty()) {
+                    SensorData lastRecord = sensorData.get(sensorData.size() - 1);
+                    LocalDateTime lastRecordTime = lastRecord.getTime().toLocalDateTime();
+                    if (lastRecordTime.isAfter(tempLastDate)) {
+                        tempLastDate = lastRecordTime;
+                        logger.info("Time of the last fetched data was changed from {} to {}.",
+                                tempLastDate.format(ISO_DATE_TIME), lastRecordTime.format(ISO_DATE_TIME));
+                    }
                 }
             }
         }
@@ -236,6 +243,13 @@ public class AzureFetcher implements ConnectorFetcher<AzureModel> {
         logger.info("Fetched data from {} to {}.", from.format(ISO_DATE_TIME), to.format(ISO_DATE_TIME));
         logger.info("Total fetched {} records.", totalFetched);
 
+        if (totalFetched == 0 && config.getEndDate().isPresent()) {
+            throw new RuntimeException(format(
+                    "Fetched all records from %s to %s. The connector is going to end.",
+                    config.getStartDate().format(ISO_DATE_TIME), config.getEndDate().get().format(ISO_DATE_TIME)
+            ));
+        }
+
         logger.debug("Set new time of fetch from {} to {}.", lastFetch.format(ISO_DATE_TIME), tempLastDate.format(ISO_DATE_TIME));
         lastFetch = tempLastDate;
 

+ 5 - 1
connector-fetch-fieldclimate/src/main/java/cz/senslog/connector/fetch/fieldclimate/FieldClimateFetcher.java

@@ -3,6 +3,8 @@ package cz.senslog.connector.fetch.fieldclimate;
 import cz.senslog.connector.fetch.api.ConnectorFetcher;
 import cz.senslog.connector.model.fieldclimate.FieldClimateModel;
 
+import java.time.LocalDateTime;
+
 import static java.time.LocalDateTime.MIN;
 
 public class FieldClimateFetcher implements ConnectorFetcher<FieldClimateModel> {
@@ -10,8 +12,10 @@ public class FieldClimateFetcher implements ConnectorFetcher<FieldClimateModel>
     @Override
     public void init() {}
 
+    int days = 5;
     @Override
     public FieldClimateModel fetch() {
-        return new FieldClimateModel(MIN, MIN);
+        LocalDateTime max = MIN.plusDays(days--);
+        return new FieldClimateModel(MIN, max);
     }
 }

+ 7 - 3
connector-push-rest-senslog-v2/src/main/java/cz/senslog/connector/push/rest/senslog/v2/SenslogV2Pusher.java

@@ -37,8 +37,12 @@ class SenslogV2Pusher implements ConnectorPusher<SenslogV2Model> {
 
     @Override
     public void push(SenslogV2Model model) {
-        throw logger.throwing(new UnsupportedOperationException(format(
-                "%s#push(%s) is not implemented.", SenslogV2Pusher.class, SenslogV2Model.class.getSimpleName()
-        )));
+        if (model.getTo().isAfter(model.getFrom())) {
+            logger.info("Received model: " + model);
+        } else {
+            throw logger.throwing(new UnsupportedOperationException(format(
+                    "%s#push(%s) is not implemented.", SenslogV2Pusher.class, SenslogV2Model.class.getSimpleName()
+            )));
+        }
     }
 }

+ 6 - 1
docker-compose.yaml

@@ -26,4 +26,9 @@ services:
     environment:
         APP_PARAMS: -cf config/test.yaml
         DEBUG: "false"
-        LOG_MONITOR: "false"
+        LOG_MONITOR: "false"
+
+networks:
+  default:
+    external:
+      name: elasticsearch-elk_default

+ 1 - 1
docker/filebeat.yml

@@ -159,7 +159,7 @@ setup.kibana:
 #----------------------------- Logstash output --------------------------------
 output.logstash:
   # The Logstash hosts
-  hosts: ["localhost:5044"]
+  hosts: ["localhost:5044", "172.23.0.2:5044"]
 
   # Optional SSL. By default is off.
   # List of root certificates for HTTPS server verifications

+ 6 - 0
pom.xml

@@ -99,6 +99,12 @@
                         <fileset>
                             <directory>${build.folder}</directory>
                         </fileset>
+                        <fileset>
+                            <directory>${basedir}</directory>
+                            <includes>
+                                <include>**/*.log</include>
+                            </includes>
+                        </fileset>
                     </filesets>
                 </configuration>
             </plugin>