All Downloads are FREE. Search and download functionalities are using the official Maven repository.

freemarker.log.ftl Maven / Gradle / Ivy

There is a newer version: 5.6.0
Show newest version
<#ftl output_format="JSON">
<#macro stringOrNull data="">
  <#if data != "">
  "${data}"
  <#else>
  null
  

{ "index" : { "_index" : "${index}", "_type" : "${documentType}", "_id" : "${log.getRequestId()}" } }
<@compress single_line=true>
{
  "@timestamp":"${@timestamp}",
  "api":"${log.getApi()}"
  <#if log.getClientRequest()??>
  ,"client-request": {
  "method":"${log.getClientRequest().getMethod()}",
  "uri":"${log.getClientRequest().getUri()}"
    <#if log.getClientRequest().getBody()??>
    ,"body":"${log.getClientRequest().getBody()?j_string}"
    
    <#if log.getClientRequest().getHeaders()??>
    ,"headers":{
      <#list log.getClientRequest().getHeaders() as headerKey, headerValue>
      "${headerKey}": [
        <#list headerValue as value>
        "${value?j_string}"
          <#sep>,
        
      ]
        <#sep>,
      
    }
    
  }
  ,"client-response": {
  "status":${log.getClientResponse().getStatus()}
    <#if log.getClientResponse().getBody()??>
    ,"body":"${log.getClientResponse().getBody()?j_string}"
    
    <#if log.getClientResponse().getHeaders()??>
    ,"headers":{
      <#list log.getClientResponse().getHeaders() as headerKey, headerValue>
      "${headerKey}": [
        <#list headerValue as value>
        "${value?j_string}"
          <#sep>,
        
      ]
        <#sep>,
      
    }
    
  }
  
  <#if log.getProxyRequest()??>
  ,"proxy-request": {
  "method":"${log.getProxyRequest().getMethod()}",
  "uri":"${log.getProxyRequest().getUri()}"
    <#if log.getProxyRequest().getBody()??>
    ,"body":"${log.getProxyRequest().getBody()?j_string}"
    
    <#if log.getProxyRequest().getHeaders()??>
    ,"headers":{
      <#list log.getProxyRequest().getHeaders() as headerKey, headerValue>
      "${headerKey}": [
        <#list headerValue as value>
          <#if value??>
          "${value?j_string}"
            <#sep>,
          
        
      ]
        <#sep>,
      
    }
    
  }
  
  <#if log.getProxyResponse()??>
  ,"proxy-response": {
  "status":${log.getProxyResponse().getStatus()}
    <#if log.getProxyResponse().getBody()??>
    ,"body":"${log.getProxyResponse().getBody()?j_string}"
    
    <#if log.getProxyResponse().getHeaders()??>
    ,"headers":{
      <#list log.getProxyResponse().getHeaders() as headerKey, headerValue>
      "${headerKey}": [
        <#list headerValue as value>
          <#if value??>
          "${value?j_string}"
            <#sep>,
          
        
      ]
        <#sep>,
      
    }
    
  }
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy