0
votes

I would like to create a custom LogBack Appender for InfluxDB. For that, I want to define many series and use the power of logback

<appender name="INFLUXDB" class="org.labaix.logback.InfluxDbAppender">
   <series>
     <serie>
        <id>SensorTemperatureMonthly</id>
        <name>machine.%X{machine}.type.%X{type} temperature_${byMonth}</name>
        <timeUnit>MILLISECONDS</timeUnit>
     </serie>
     <serie>
        <id>SensorTemperatureDaily</id>
        <name>machine.%X{machine}.type.%X{type} temperature_${day}</name>
        <timeUnit>MILLISECONDS</timeUnit>
     </serie>
   </series>
</appender>

Therefore I don't know how to map list of series. Any ideas ? It is not in documentation so I wonder if it possible.

Thanks. Best regards Nicolas

1

1 Answers

0
votes

Rather than this approach I would prefer to use xml and use JAXB object to load data. You can pass the configuration file xml path as an parameter

<appender name="INFLUXDB" class="org.labaix.logback.InfluxDbAppender">
   <configFilePath>configFilePath.xml</configFilePath>
</appender>

The configuration file

<root>
  <series>
     <serie>
        <id>SensorTemperatureMonthly</id>
        <name>machine.%X{machine}.type.%X{type} temperature_${byMonth}</name>
        <timeUnit>MILLISECONDS</timeUnit>
     </serie>
     <serie>
        <id>SensorTemperatureDaily</id>
        <name>machine.%X{machine}.type.%X{type} temperature_${day}</name>
        <timeUnit>MILLISECONDS</timeUnit>
     </serie>
   </series>
</root>