OpenConext / OpenConext-attribute-aggregation

OpenConext attribute aggregation
Apache License 2.0
1 stars 2 forks source link

Add informational logging about aggregations performed #119

Closed phavekes closed 4 hours ago

phavekes commented 4 hours ago

This issue is imported from pivotal - Originaly created at Nov 15, 2017 by Thijs Kinkhorst

In order to create some stats about usage, we want to have some simple info-level logging that logs when EB kicks off an aggregation (or that is finished), with at least the following info:

We can then easily make some ELK-graphs.

phavekes commented 4 hours ago

An "analytics" Logger has been added that logs the requested information under threshold INFO. Just as we did with PDP a corresponding appender can be configured in the logback.xml to output all the "analytics" log statements to Syslog and from there to ELK. (Okke Harsta - Jun 8, 2018)

phavekes commented 4 hours ago

So it does not show on test2 in /var/log/attribute-aggregation.log... expected? (Thijs Kinkhorst - Jun 10, 2018)

phavekes commented 4 hours ago

It will only show the information when there is Logger configured in the logback.xml with the name "analytics" (Okke Harsta - Jun 10, 2018)

phavekes commented 4 hours ago

I added this:

 <appender name="analytics" class="ch.qos.logback.core.rolling.RollingFileAppender">
   <file>/var/log/attribute-aggregation/analytics.log</file>
   <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
     <!-- daily rollover -->
     <fileNamePattern>/var/log/attribute-aggregation/analytics-%d{yyyy-MM-dd}.log</fileNamePattern>
     <maxHistory>30</maxHistory>
   </rollingPolicy>
   <encoder>
     <pattern>%d{ISO8601} %5p [%t] %logger{40}:%L - %m%n</pattern>
   </encoder>
 </appender>

but don\'t see a result..? (Thijs Kinkhorst - Dec 11, 2018)

phavekes commented 4 hours ago

Almost. For this use-case you need to use additivity. I changed the logback template in OpenConext-deploy:

<appender name="ANALYTICS-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
   <file>/var/log/attribute-aggregation/analytics.log</file>
   <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
     <!-- daily rollover -->
     <fileNamePattern>/var/log/attribute-aggregation/analytics-%d{yyyy-MM-dd}.log</fileNamePattern>
     <maxHistory>30</maxHistory>
   </rollingPolicy>
   <encoder>
     <pattern>%d{ISO8601} %5p [%t] %logger{40}:%L - %m%n</pattern>
   </encoder>
 </appender>

  <logger name="analytics" level="DEBUG" additivity="false">
    <appender-ref ref="ANALYTICS-FILE"/>
  </logger>

And now it works. (Okke Harsta - Dec 11, 2018)