By: Cedric Ferraris user 22 Mar 2017 at 8:37 a.m. CDT

9 Responses
Cedric Ferraris gravatar
Hello, I would like to configure log forwarding to a Graylog2 log server (GELF format) but could not find relevant documentation for that. 1- Does Gluu use log4j 1 or 2? 2- Where are the configuration files for log4j? XML or properties format? I could only find: ``` -bash-4.2# find . -name log4j.* ./opt/jetty-9.3/jetty-distribution-9.3.15.v20161220/resources/log4j.properties ``` And to add dependencies in a pom.xml file, which one to use: ``` -bash-4.2# find . -name pom.xml ./opt/jetty-9.3/temp/jetty-localhost-8081-oxauth.war-_oxauth-any-5169693371755537645.dir/webapp/META-INF/maven/org.xdi/oxauth-server/pom.xml ./opt/jetty-9.3/temp/jetty-localhost-8086-idp.war-_idp-any-6293967704827206373.dir/webapp/META-INF/maven/org.xdi/oxshibbolethIdp/pom.xml ./opt/jetty-9.3/temp/jetty-localhost-8082-identity.war-_identity-any-3613373546097801187.dir/webapp/META-INF/maven/org.xdi/oxtrust-server/pom.xml ``` There are available GELF appenders for log4j such as this one ([link](https://marketplace.graylog.org/addons/a3c8bbdf-6b47-43fe-8298-f259db85fc59)) but I need to know in which files it needs to be configured on the Gluu side. Thanks!

By Aliaksandr Samuseu staff 22 Mar 2017 at 10:37 a.m. CDT

Aliaksandr Samuseu gravatar
Hi, Cedric. We have page on logging [here](https://gluu.org/docs/ce/3.0.1/operation/logs/) We also have a certain framework allowing to aggregate logs at one database: [link](https://github.com/GluuFederation/message-consumer) Let me know whether this helps.

By Cedric Ferraris user 22 Mar 2017 at 1:53 p.m. CDT

Cedric Ferraris gravatar
Thanks, I'll have a look at it.

By Michael Schwartz Account Admin 22 Mar 2017 at 4:13 p.m. CDT

Michael Schwartz gravatar
Gluu 3.0 uses log4j 2. Unfortunately, right now `log4j2.xml` is in the war file. Search for it... ``` # find /opt | grep log4j2.xml ```

By Cedric Ferraris user 23 Mar 2017 at 8:21 a.m. CDT

Cedric Ferraris gravatar
This command returns: ``` /opt/jetty-9.3/temp/jetty-localhost-8082-identity.war-_identity-any-3613373546097801187.dir/webapp/WEB-INF/classes/log4j2.xml /opt/jetty-9.3/temp/jetty-localhost-8081-oxauth.war-_oxauth-any-129770593283709586.dir/webapp/WEB-INF/classes/log4j2.xml ``` Those are the same files described in the link Aliaksandr sent. So I assume I can just modify them to fit my needs and restart the corresponding service (identity or oxauth)? Thanks

By Aliaksandr Samuseu staff 23 Mar 2017 at 8:40 a.m. CDT

Aliaksandr Samuseu gravatar
I believe those are only temporary contents unpacked from corresponding `.war` archives, and all changes will be wiped out after restart. You need to unpack those files from each component's archive itself and merge them back into archives after editing. It can be done with `jar` tool that is already present in container. You can find all components' archives with `# find /opt/gluu/jetty/ -ipath "*.war"`

By Cedric Ferraris user 23 Mar 2017 at 8:48 a.m. CDT

Cedric Ferraris gravatar
Got it! When you say restart, you mean restart of the machine or restart of the service?

By Aliaksandr Samuseu staff 23 Mar 2017 at 8:50 a.m. CDT

Aliaksandr Samuseu gravatar
It's enough to restart corresponding service inside container (the one whose archive was edited).

By Cedric Ferraris user 21 Sep 2018 at 12:28 p.m. CDT

Cedric Ferraris gravatar
Hello, Since it's been more than 1 year, I'm just checking if there has been any change regarding the way external logging is configured? Or if we still need to do : unpacking war files / modifying log4j2.xml / repacking war files / restarting services ? We're running 3.1.3. Thanks

By Aliaksandr Samuseu staff 21 Dec 2018 at 1:17 p.m. CST

Aliaksandr Samuseu gravatar
Hi, Cedric. No change to this, it turns out. Feel free to submit enhancement proposal on Github if you have a better perspective on how it should be handled.