       time = moment(line._source["@timestamp"]).utc().format("HH:mm")
       content += "<p>#{time} <span>#{escape line._source.nick}</span>: #{escape line._source.message}</p>"
     content += "</div>"
-    content += foot_html(logKibanaUrlName + '/#/dashboard/file/' + logKibanaTemplateName+ '.json?room=' + room)
+    content += @foot_html()
     content
 
-  html_head = (title) ->
+  html_head: (title) ->
     """
     <html>
       <head>


  missingEnvironmentForApi: (msg) ->
    missingAnything = false
    unless logESUrl?
      msg.send "Ensure that GANDI_LOG_ES_URL is set."
      missingAnything |= true
    unless logRooms?
      msg.send "Ensure that GANDI_LOG_ROOMS is set."
      missingAnything |= true
    unless logIndexName?
      msg.send "Ensure that GANDI_LOG_INDEX_NAME is set."
      missingAnything |= true
    unless logKibanaUrlName?
      msg.send "Ensure that GANDI_LOG_KIBANA_URL is set."
      missingAnything |= true
    unless logKibanaTemplateName?
      msg.send "Ensure that GANDI_LOG_KIBANA_TEMPLATE is set."
      missingAnything |= true
    missingAnything



      size: 1000
    }
    json = JSON.stringify(query)
    index = @logIndexName + '-' + start.format('YYYY.MM.DD')
    index_end = @logIndexName + '-' + stop.format('YYYY.MM.DD')
    if index == index_end
      @searchES index, json, (body) ->
        cb body.hits.hits
    else
      @searchES index, json, (body) ->
        @searchES index_end, json, (body_end) ->
          cb body.hits.hits.concat(body_end.hits.hits)

  getLastTerm: (room, term, cb) ->
    query = {
      query: {
        bool: {
