Class LogEventHttpServer


  • public class LogEventHttpServer
    extends AbstractLogEventHttpServer
    The simplest way to expose your logs in your web browser, LogEventHttpServer runs an embedded http server in your application for the logs app console. Requires that you configure an OpenIdConfiguration so you don't accidentally expose it insecurely. See OpenIdConfiguration for details on how to set this up.

    Running with http (unencrypted)

    The simplest way to get LogEventHttpServer up a running is to use http. However, this will probably only work for localhost, because OpenID Connect providers generally only allow apps to use http for localhost.
    1. observer.web=WebLogEventServer
    2. Register a WebLogEventObserver with an httpPort. (E.g. observer.web.httpPort=8080)
    3. Setup a OpenIdConfiguration (e.g. observer.web.openIdIssuer=https://login.microsoft.com, observer.web.clientId=..., observer.web.clientSecret=...)
    4. Start your application with the configuration
    5. Open a web browser to e.g. http://localhost:8080/logs. You will now be logged in with your Open ID Connect provider and the see your logs
    This allows you to access you log from localhost. If you want remote access, you should put your application behind a https reverse proxy.

    Sample config

     observer.web=WebLogEventObserver
     observer.web.openIdIssuer=https://login.microsoftonline.com/common
     observer.web.clientId=12345678-abcd-pqrs-9876-9abcdef01234
     observer.web.clientSecret=3¤..¤!?qwer
     observer.web.source=DatabaseLogEventObserver
     observer.web.source.jdbcUrl=...
     observer.web.httpsPort=8443
     observer.web.keyStore=MyCertificate.p12
     observer.web.keyStorePassword=mfldnlsnaa
     observer.web.hostKeyPassword=2112wfsasa
     
    • Constructor Detail

      • LogEventHttpServer

        public LogEventHttpServer()
    • Method Detail

      • setHostname

        public void setHostname​(String hostname)
      • setLogEventsHtml

        public void setLogEventsHtml​(String logEventsHtml)
      • setOpenIdConfiguration

        public void setOpenIdConfiguration​(OpenIdConfiguration openIdConfiguration)
      • setLogEventSource

        public void setLogEventSource​(LogEventSource logEventSource)
      • start

        public void start()
      • getUrl

        public String getUrl()
      • httpHandler

        protected void httpHandler​(com.sun.net.httpserver.HttpExchange exchange)
                            throws IOException
        Throws:
        IOException
      • setCookieVault

        public void setCookieVault​(CryptoVault cookieVault)