|
| 1 | +# Weblogic Logging Exporter |
| 2 | + |
| 3 | +An exporter that adds a log event handler to the weblogic server, such that WLS server Logs can be integrated to [Elastic Stack](https://www.elastic.co/products) in Kubernetes directly, by using the REST API in [Elasticsearch](https://www.elastic.co/products/elasticsearch). |
| 4 | + |
| 5 | +The blog [Let WebLogic work with Elastic Stack in Kubernetes](https://blogs.oracle.com/weblogicserver/let-weblogic-work-with-elk-in-kubernetes) outlines steps that can be used to harvest WLS server logs using Logstash so that they can be filtered, manipulated, and viewed using Elasticsearch and Kibana. |
| 6 | +However, that approach requires the setup of a shared volume which is outside of the pod, and the logs needs to be written out to an intermediate log file for harvesting and parsing. |
| 7 | + |
| 8 | +The goal of this project is to provide an easy to configure, robust and production ready solution to access WLS log information through Elasticsearch and Kibana. |
| 9 | + |
| 10 | +## Getting Started |
| 11 | + |
| 12 | +These instructions outlines the steps to build the _weblogic-logging-exporter.jar_ , which can then be integrated to the [Weblogic Kubernetes Operator](https://github.com/oracle/weblogic-kubernetes-operator/) for handling the Server logs generated by the Weblogic Server Domain. |
| 13 | + |
| 14 | +### Prerequisites |
| 15 | + |
| 16 | +Weblogic Logging Exporter depends on the Weblogic Logging Jar which is available from the [ Oracle Maven Repository](http://maven.oracle.com/). |
| 17 | + |
| 18 | +To access the Oracle Maven Repository, there are two fundamental requirements to be aware of: |
| 19 | + |
| 20 | +1. You must be using [Maven 3.2.5](http://maven.apache.org/docs/3.2.5/release-notes.html) or later. This contains the version of the component [Wagon 2.8](http://maven.apache.org/wagon/) that has been enhanced to support access to artifacts that are protected by [HTTP authentication schemes](https://issues.apache.org/jira/projects/WAGON/issues/WAGON-422). |
| 21 | + |
| 22 | +2. You must be registered with OTN and have accepted the agreement to access and use the Oracle Maven Repository. This can be done with either a new or an existing OTN user account by accessing the http://maven.oracle.com site and clicking the registration link. |
| 23 | +Once registered, you then just need to configure your local Maven environment with the details of the Oracle Maven Repository, including information that relates to the authentication model specifying your OTN username and password. |
| 24 | + |
| 25 | +### Building |
| 26 | +#### Configure Maven |
| 27 | + |
| 28 | +**1. Encrypt your OTN Password** |
| 29 | + |
| 30 | +You need to configure Maven to use the Oracle Maven Repository. This involves telling Maven about the repository and providing the necessary information to authenticate to the repository. |
| 31 | +The following steps shows you how to save your OTN password in your _settings.xml_ file so that you do not have to specify them manually every time. |
| 32 | +Oracle recommends that you encrypt your password, using the utilities provided with Maven. |
| 33 | + |
| 34 | +Here is the steps to encrypt your password and save that in your settings. Refer to [Maven Password Encryption](http://maven.apache.org/guides/mini/guide-encryption.html) for more information. |
| 35 | + |
| 36 | +``` |
| 37 | +mvn --encrypt-master-password my_master_password |
| 38 | +
|
| 39 | +``` |
| 40 | +The output will be a string similar to this: |
| 41 | + |
| 42 | +_{abcdefghijklmnopqrstuvwxyz123=}_ |
| 43 | + |
| 44 | +Save this value in your Maven _settings-security.xml_ file |
| 45 | + |
| 46 | +A copy of your _~/.m2/settings-security.xml_ will look like this |
| 47 | +``` |
| 48 | +<settingsSecurity> |
| 49 | + <master>{abcdefghijklmnopqrstuvwxyz123=}</master> |
| 50 | +</settingsSecurity> |
| 51 | +``` |
| 52 | + |
| 53 | +Now that you have a master password defined, you can encrypt your OTN password using the following command: |
| 54 | +``` |
| 55 | +mvn --encrypt-password my_OTN_password |
| 56 | +``` |
| 57 | +The output will be another string that looks like this: |
| 58 | + |
| 59 | +_{==thisIs12My34_OTN_45_encrypted==}_ |
| 60 | + |
| 61 | +This will be the password that you provide in the _server_ section of your _settings.xml_ file when you configure the HTTP Wagon. |
| 62 | + |
| 63 | +**2. Adding the Oracle Maven Repository to Your settings.xml** |
| 64 | + |
| 65 | +Add a repository definition to your Maven settings.xml file. The repository definition should look like the following: |
| 66 | + |
| 67 | +``` |
| 68 | +<profiles> |
| 69 | + <profile> |
| 70 | + <id>main</id> |
| 71 | + <activation> |
| 72 | + <activeByDefault>true</activeByDefault> |
| 73 | + </activation> |
| 74 | + <repositories> |
| 75 | + <repository> |
| 76 | + <id>maven.oracle.com</id> |
| 77 | + <url>https://maven.oracle.com</url> |
| 78 | + <layout>default</layout> |
| 79 | + <releases> |
| 80 | + <enabled>true</enabled> |
| 81 | + </releases> |
| 82 | + </repository> |
| 83 | + </repositories> |
| 84 | +
|
| 85 | + <pluginRepositories> |
| 86 | + <pluginRepository> |
| 87 | + <id>maven.oracle.com</id> |
| 88 | + <url>https://maven.oracle.com</url> |
| 89 | + </pluginRepository> |
| 90 | + </pluginRepositories> |
| 91 | + </profile> |
| 92 | + </profiles> |
| 93 | +``` |
| 94 | + |
| 95 | +The Maven settings.xml requires additional settings to support the Oracle Maven Repository. |
| 96 | +Add the following _<server>_ element to the _<servers>_ section of the Maven settings.xml to configure the HTTP Wagon. |
| 97 | +``` |
| 98 | +<servers> |
| 99 | + <server> |
| 100 | + <username>my_OTN_user_name</username> |
| 101 | + <password>{==thisIs12My34_OTN_45_encrypted==}</password> |
| 102 | + <configuration> |
| 103 | + <basicAuthScope> |
| 104 | + <host>ANY</host> |
| 105 | + <port>ANY</port> |
| 106 | + <realm>OAM 11g</realm> |
| 107 | + </basicAuthScope> |
| 108 | + <httpConfiguration> |
| 109 | + <all> |
| 110 | + <params> |
| 111 | + <property> |
| 112 | + <name>http.protocol.allow-circular-redirects</name> |
| 113 | + <value>%b,true</value> |
| 114 | + </property> |
| 115 | + </params> |
| 116 | + </all> |
| 117 | + </httpConfiguration> |
| 118 | + </configuration> |
| 119 | + <id>maven.oracle.com</id> |
| 120 | + </server> |
| 121 | + </servers> |
| 122 | +``` |
| 123 | + |
| 124 | +If needed, you will need to specify the _proxies_ that is required. |
| 125 | + |
| 126 | +**3. Clone the project and build** |
| 127 | +``` |
| 128 | +git clone git@orahub.oraclecorp.com:derek.sharpe/wls-logging-exporter.git |
| 129 | +mvn install |
| 130 | +``` |
| 131 | + |
| 132 | +The _weblogic-logging-exporter-1.0-SNAPSHOT.jar_ should be available under _target_ directory |
| 133 | + |
| 134 | +## Deployment |
| 135 | + |
| 136 | +TBD. Update on how to integrate this jar to weblogic kubernetes operator. |
| 137 | + |
| 138 | +## Contributing |
| 139 | + |
| 140 | +Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us. |
| 141 | + |
| 142 | + |
| 143 | +## License |
| 144 | + |
| 145 | +This project is licensed under the [_Oracle Universal Permissive License, Version 1.0_](http://oss.oracle.com/licenses/upl) |
0 commit comments