NIH | National Cancer Institute | NCI Wiki  

The Statistical Dashboard has some dependencies on the Apache Proxy access logs, with the possibilities of using Tomcat access logs as well as the Apache Proxy error logs.   These logs require parsing and shipping to an Elasticsearch intense for parsing into indexed documents which can be served up, in turn, to an application framework such as Spring Boot, which can support a UI for dashboard display.  We are providing configuration files and sample code as prototyping support should we use this approach for a dashboard back end.

ELK Stack

We built our prototypes with a minimal approach using the following applications as the tech stack.  We may add Logstash if we see a need for its filtering capabilities

  • Filebeats
  • Elasticsearch
  • Kabana

Elasticsearch Configuration - default

Kabana Configuration - default

Filebeat Configuration


Apache Module Configuration

# Module: apache
# Docs:

- module: apache
  # Access logs
    enabled: true
    var.paths: ["/var/log/apache/access.log"]
    ##The type:access_log will help us point these logs to the right direction
     # processors:
       # - add_fields:
           # target: fields
             # codec: plain
              #type: access_log

Java Code Snippet for Elasticsearch Query Over Indexes of Parsed Logs

We'll need a java implementation to Elasticsearch's REST API to provide to the service side of a Spring Boot based web application UI.
package search.client.test;

import java.util.concurrent.TimeUnit;

import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.message.BasicHeader;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.Response;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilders;

public class RestTest {
	public void run() {

	RestClientBuilder builder =  RestClient.builder(
	        new HttpHost("localhost", 9200, "http"));
	Header[] defaultHeaders = new Header[]{new BasicHeader("header", "value")};
		    new RestClientBuilder.RequestConfigCallback() {
		        public RequestConfig.Builder customizeRequestConfig(
		                RequestConfig.Builder requestConfigBuilder) {
		            return requestConfigBuilder.setSocketTimeout(10000); 

	RestHighLevelClient restClient = new RestHighLevelClient(builder);
	SearchSourceBuilder sourceBuilder = new SearchSourceBuilder(); 
	sourceBuilder.query(QueryBuilders.termQuery("event.outcome", "failure")); 
	sourceBuilder.timeout(new TimeValue(60, TimeUnit.SECONDS)); 
	SearchRequest searchRequest = new SearchRequest();
	SearchResponse searchResponse = null;

	try {
		searchResponse =, RequestOptions.DEFAULT);
	} catch (IOException e) {
		// TODO Auto-generated catch block
	SearchHits hits = searchResponse.getHits();
	hits.forEach(x -> System.out.println(x.toString()));
	public static void main(String ...strings ) {
		new RestTest().run();

  • No labels