Project

General

Profile

Actions

Feature #1814

closed

Prepare script for log rotation of connector server

Added by Roman Kučera over 5 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Luděk Urban
Target version:
-
Start date:
08/23/2019
Due date:
% Done:

0%

Estimated time:
Owner:

Description

This connector should be used in connector server and now it's logging to file but rotating of this file is not solved.
Prepare script for log rotating on Linux environment

You can follow steps in https://wiki.czechidm.com/devel/documentation/adm/systems/winrm_ad_connector?s[]=connector&s[]=server#installation how to download and use connector server.

Typical usage is that we have connector server in /opt/connid-connector-server
Connector logs are now in /opt/connid-connector-server/logs/connectorserver0.log
Config for connector and logging are in /opt/connid-connector-server/conf

The result should be that log will be rotated every day.
Connector server can be run on Linux or Windows


Related issues

Related to IdStory Identity Manager - Task #690: Automatic tomcat log rotationClosedLuděk Urban09/05/2017

Actions
Actions #1

Updated by Radek Tomiška over 5 years ago

  • Related to Task #690: Automatic tomcat log rotation added
Actions #2

Updated by Roman Kučera over 5 years ago

  • Description updated (diff)
Actions #3

Updated by Roman Kučera over 5 years ago

  • Description updated (diff)
Actions #5

Updated by Roman Kučera over 5 years ago

  • Description updated (diff)
Actions #6

Updated by Luděk Urban over 5 years ago

  • Status changed from New to In Progress
  • Assignee set to Luděk Urban

I tried install connector server, but server doesn't log to file. Server not load logback-spring.xml or logback-core.jar.
For next step I will try add connector. Maybe connector server use logback only if there is a connector.

Actions #7

Updated by Luděk Urban over 5 years ago

Finally manage to log to file from connector-server. Connector server is using logging.properties like IdM.
I will try rotate logs like in idm on windows - #690.

Actions #8

Updated by Luděk Urban over 5 years ago

I tried configure logback but connector-server not even opens logback.xml file.
I also tried configure logging properties but java.util.logging.FileHandler can't rotate log files.

Actions #9

Updated by Luděk Urban about 5 years ago

I tried add logger from log4j, sflm4j and logback but all of them don't work with connector server.
Error was:

Caused by: java.lang.InstantiationException: org.apache.logging.log4j.Logger
    at java.lang.Class.newInstance(Class.java:427)
    at org.identityconnectors.common.logging.Log.getLog(Log.java:147)
    ... 5 more
Caused by: java.lang.NoSuchMethodException: org.apache.logging.log4j.Logger.<init>()
    at java.lang.Class.getConstructor0(Class.java:3082)
    at java.lang.Class.newInstance(Class.java:412)

It's probrably bug in connector server where he use method "getConstructor" which is only in juli logger.

Actions #10

Updated by Luděk Urban about 5 years ago

I created a workaround which uses logrotate.

I used default connector server logger class "org.identityconnectors.common.logging.impl.JDKLogger"
Then a change "/opt/connid-connector-server/conf/logging.properties" to log into "logs/connectorserver.log" file in conector server directory:

handlers=java.util.logging.FileHandler
java.util.logging.FileHandler.pattern = logs/connectorserver.log
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.FileHandler.append = true
level=DEBUG

As a final step a configure logrotate to rotate file "/opt/connid-connector-server/logs/connectorserver.log" and keep 14 days of backup.

Configuration /etc/logrotate.d/connector_server

/opt/connid-connector-server/logs/connectorserver.log {
    copytruncate
    daily
    rotate 14
    compress
    dateext
    missingok
    create 0644 connector-server connector-server
    su connector-server connector-server
}

This workaround works but it would be better to have all configuration inside connector server and not use logrotate.

Actions #11

Updated by Petr Fišer almost 5 years ago

Added chapter to official installation guide on the wiki. Only the logrotate configuration is needed, works with default JDKLogger.
https://wiki.czechidm.com/devel/documentation/adm/systems/connectors/remote_server

Actions #12

Updated by Roman Kučera over 4 years ago

@urbanl @fiserp Can we close this ticket? As far as I know this should be already implemented and we have it in our wiki guide.

Actions #13

Updated by Petr Fišer over 4 years ago

The logrotate solution works but it is a Linux-only. That is why this ticket is probably still open.
We need to rotate logs on Windows too.

Actions #14

Updated by Luděk Urban over 4 years ago

status check

I found that logback.xml in our connector and in Original ConID connector differs. Our has commented log rotation setting.
Previously I found that our connector server doesn't load/read logback configuration.

Next step:
  • Check again if logback configuration has been loaded or not
  • Ckeck if log rotation can be set in logrotate
Actions #15

Updated by Luděk Urban about 4 years ago

  • Status changed from In Progress to Closed

I checked if we use connector server and I found that we don't use it on Windows.
Because there isn't any working solutions resolution of rotation logs on connector server yet and we don't need it now I will close this ticket.
If we need deploy connector server on windows I open this ticket again.

Actions

Also available in: Atom PDF