Repository: logging-log4j-audit Updated Branches: refs/heads/master b75cbcd16 -> 3b40bf69b
Update documentation Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/3b40bf69 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/3b40bf69 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/3b40bf69 Branch: refs/heads/master Commit: 3b40bf69b0ce1f3007ac3fd7c57f4cf986fdc241 Parents: b75cbcd Author: Ralph Goers <[email protected]> Authored: Sun Mar 18 21:45:11 2018 -0700 Committer: Ralph Goers <[email protected]> Committed: Sun Mar 18 21:45:11 2018 -0700 ---------------------------------------------------------------------- log4j-catalog/log4j-catalog-editor/pom.xml | 82 -------------------- .../log4j/catalog/AuditCatalogEditor.java | 4 - src/site/markdown/index.md.vm | 4 +- src/site/site.xml | 1 - src/site/xdoc/gettingStarted.xml.vm | 63 +++++++++------ 5 files changed, 44 insertions(+), 110 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/3b40bf69/log4j-catalog/log4j-catalog-editor/pom.xml ---------------------------------------------------------------------- diff --git a/log4j-catalog/log4j-catalog-editor/pom.xml b/log4j-catalog/log4j-catalog-editor/pom.xml index fa8fe36..3503c76 100644 --- a/log4j-catalog/log4j-catalog-editor/pom.xml +++ b/log4j-catalog/log4j-catalog-editor/pom.xml @@ -126,84 +126,10 @@ <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-catalog-api</artifactId> </dependency> - <!-- <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - </dependency> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context-support</artifactId> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-webmvc</artifactId> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-beans</artifactId> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - </dependency> --> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-rest-webmvc</artifactId> </dependency> - <!-- <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-web</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.datatype</groupId> - <artifactId>jackson-datatype-jsr310</artifactId> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - </dependency> --> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-jpa</artifactId> @@ -220,14 +146,6 @@ <groupId>org.modelmapper.extensions</groupId> <artifactId>modelmapper-jackson</artifactId> </dependency> - <!-- <dependency> - <groupId>org.thymeleaf</groupId> - <artifactId>thymeleaf</artifactId> - </dependency> - <dependency> - <groupId>org.thymeleaf</groupId> - <artifactId>thymeleaf-spring4</artifactId> - </dependency>--> </dependencies> <build> <plugins> http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/3b40bf69/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/AuditCatalogEditor.java ---------------------------------------------------------------------- diff --git a/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/AuditCatalogEditor.java b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/AuditCatalogEditor.java index 8a37bec..c75065a 100644 --- a/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/AuditCatalogEditor.java +++ b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/AuditCatalogEditor.java @@ -20,14 +20,10 @@ import java.io.IOException; import java.io.InputStream; import java.util.Properties; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.catalog.api.util.ProfileUtil; -import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.support.SpringBootServletInitializer; -import org.springframework.context.annotation.Configuration; /** * http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/3b40bf69/src/site/markdown/index.md.vm ---------------------------------------------------------------------- diff --git a/src/site/markdown/index.md.vm b/src/site/markdown/index.md.vm index ad32740..5199f10 100644 --- a/src/site/markdown/index.md.vm +++ b/src/site/markdown/index.md.vm @@ -105,4 +105,6 @@ editor for that catalog as well as the REST endpoints to manipulate the dynamic $h2 Requirements Log4j Audit requires Java 8 and Log4j 2.10.0 or greater. - +A Git repo to maintain the JSON catalog of events and attributes is required. +A database is required if the application wants to define dynamic catalog events and attributes. Log4j Audit provides +built in support for PostgresQL. http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/3b40bf69/src/site/site.xml ---------------------------------------------------------------------- diff --git a/src/site/site.xml b/src/site/site.xml index c29dec8..4f1a6b8 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -55,7 +55,6 @@ </menu> <menu name="Project Information" img="icon-info-sign"> - <item name="Dependencies" href="/dependencies.html" /> <item name="Dependency Convergence" href="/dependency-convergence.html" /> <item name="Dependency Management" href="/dependency-management.html" /> <item name="Project Team" href="/team-list.html" /> http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/3b40bf69/src/site/xdoc/gettingStarted.xml.vm ---------------------------------------------------------------------- diff --git a/src/site/xdoc/gettingStarted.xml.vm b/src/site/xdoc/gettingStarted.xml.vm index 9a1db17..2ecab86 100644 --- a/src/site/xdoc/gettingStarted.xml.vm +++ b/src/site/xdoc/gettingStarted.xml.vm @@ -52,6 +52,7 @@ <p>Create a directory for this guide:<br /> <code><pre> + cd ~ mkdir log4j-audit-guide cd log4j-audit-guide</pre></code></p> @@ -65,10 +66,11 @@ cd logging-log4j-audit-sample mvn clean install</pre></code></p> - <p>Two artifacts will have been created and installed into your local Maven repository: + <p>Three artifacts will have been created and installed into your local Maven repository: <ol> - <li>org.apache.logging.log4j:audit-service-api:1.0.0-SNAPSHOT:jar</li> - <li>org.apache.logging.log4j:audit-service-war:1.0.0-SNAPSHOT:war</li> + <li>org.apache.logging.log4j:audit-service-api:${Log4jAuditVersion}:jar</li> + <li>org.apache.logging.log4j:audit-service-war:${Log4jAuditVersion}:war</li> + <li>org.apache.logging.log4j:audit-service:${Log4jAuditVersion}:jar</li> </ol></p> <p>The sample catalog can be found at audit-service-api/src/main/resources/catalog.json.</p> @@ -94,20 +96,38 @@ <a name="DeployAuditService"/> <subsection name="Deploy the Audit Service WAR"> <ol> - <li>Download Apache Tomcat from the <a href="https://tomcat.apache.org/download-70.cgi">Tomcat website</a>. - and install Apache Tomcat. The simplest way to install Tomcat consists of just unzipping the Tomcat - distribution into the appropriate directory. For more complete instructions follow - <a href="https://tomcat.apache.org/tomcat-7.0-doc/setup.html">the Tomcat setup page</a>. + <li>Create a temporary directory and copy the audit service jar to it.<code><pre> + cd ~ + mkdir auditService + cd auditService + cp ~/log4j-audit-guide/logging-audit-sample/audit-service/target/audit-service-${Log4jAuditVersion}.jar .</pre></code></li> + <li>Use an editor to create a file named application.properties in the directory.</li> + <li>Copy the following lines into the file. The value for remoteRepoUrl should the Git repo where your + version of catalog.json should be stored. remoteRepoCatalogPath is the location within that Git repository + where the catalog.json file resides. gitPassPhrase is the pass phrase needed to access the repository + when SSH is used. gitUserName and gitPassPhrase are the credentials required to access the Git + repository when using HTTP or HTTPS. If the credentials or pass phrase are not provided typically you + will be able to view the catalog but not update it. <code><pre> - cd .. - unzip ~/Downloads/apache-tomcat-7.0.82.zip</pre></code></li> - <li>Copy the war file generated by the pervious build into Tomcat's webapp directory: + remoteRepoUrl=https://git-wip-us.apache.org/repos/asf/logging-log4j-audit-sample.git + remoteRepoCatalogPath=audit-service-api/src/main/resources/catalog.json + gitUserName= + gitPassword= + gitPassPhrase=</pre></code></li> + <li>Start the application. <code><pre> - cp logging-log4j-audit-sample/audit-service-war/target/AuditService.war apache-tomcat-7.0.82/webapps</pre></code></li> + java -jar audit-service-${Log4jAuditVersion}.jar</pre></code></li> + <li>Wait for the application to start.</li> + <li>Generate an audit event.<code><pre> + curl -i -X POST -H 'Content-Type: application/vnd.apache.logging.log4j.audit+json; version="1.0"' \ + http://localhost:8080/event/log -d '{ "eventName": "transfer", "requestContextMap": {"loginId": "rgoers", "corpAccountNumber": "12345", "ipAddress": "127.0.0.1"}, "properties": {"toAccount": "111111", "fromAccount": "222222", "amount": "100.00"}}' + </pre></code></li> + <li>The command should respond with <code><pre>HTTP/1.1 200</pre></code></li> + <li>View the audit log at logs/AuditService/audit.log. The audit event should be present in the file.</li> </ol> </subsection> <a name="DeployAuditCatalog"/> - <subsection name="Deploy the Audit Catalog WAR"> + <subsection name="Run the Audit Catalog Editor"> <ol> <li><a href="http://www.apache.org/dist/logging/apache-log4j-audit-${Log4jAuditVersion}-bin.zip">Download</a> the Log4j audit binary zip. @@ -116,11 +136,12 @@ <li>Unzip the contents. <code><pre> unzip apache-log4j-audit-${Log4jAuditVersion}-bin.zip</pre></code></li> - <li>Copy the Log4j Catalog Editor war to the tomcat webapps directory. + <li>Copy the Log4j Catalog Editor jar to any directory. <code><pre> - cp apache-log4j-audit-${Log4jAuditVersion}-bin/log4j-catalog-war-${Log4jAuditVersion}.war apache-tomcat-7.0.82/webapps/AuditCatalog.war</pre></code></li> - <li>Use an editor to create a file named catalog-config.properties in Tomcat's classpath. You can create - the file in the apache-tomcat-7.0.82/lib directory.</li> + mkdir catalogEditor + cd catalogEditor + cp apache-log4j-audit-${Log4jAuditVersion}-bin/log4j-catalog-editor-${Log4jAuditVersion}.jar .</pre></code></li> + <li>Use an editor to create a file named application.properties in this directory.</li> <li>Copy the following lines into the file. The value for remoteRepoUrl should the Git repo where your version of catalog.json should be stored. remoteRepoCatalogPath is the location within that Git repository where the catalog.json file resides. gitPassPhrase is the pass phrase needed to access the repository @@ -133,18 +154,16 @@ gitUserName= gitPassword= gitPassPhrase=</pre></code></li> - <li>Start Tomcat. - <code><pre> - cd apache-tomcat-7.0.82/bin - ./startup.sh</pre></code></li> + <li>Start the application. + <code><pre>java -jar log4j-catalog-editor-${Log4jAuditVersion}.jar</pre></code></li> </ol> </subsection> <a name="CatalogEditor"/> <subsection name="Use the Catalog Editor"> <ol> - <li>Navigate to the edit attributes screen at http://localhost:8080/AuditCatalog/attributes. The screen + <li>Navigate to the edit attributes screen at http://localhost:8080/attributes. The screen should look like <br /><img src="images/attributes.png"/></li> - <li>Navigate to the edit events screen at http://localhost:8080/AuditCatalog/events. The screen should + <li>Navigate to the edit events screen at http://localhost:8080/events. The screen should look like <br /><img src="images/events.png"/></li> </ol> </subsection>
