Skip to content

Logging

Overview

For logs gathering Onteon uses Sonario. It is an optional tool for gathering metrics about the environment and collecting logs.

  • Click here to read how to install Sonario.
  • Click here to read how to install Onteon Control Center with monitoring enabled.
  • Click here to read how to install Onteon Node Manager with monitoring enabled.

Docker applications

If you properly installed your Node Manager (here you can read how to install Node Manager with monitoring), Onteon will automatically gather logs from Docker containers and then send it to Sonario, where logs can be viewed.

Native applications

If you want to gather logs from native applications, your application needs to write logs to proper directory in proper format.

All logs must be located in directory that is available under the '${ont_app_logs_path}' placeholder. You can provide this placeholder in the configuration e.g.:

app:
  name: 'onteon-demo-app-cookbook-native'
  version: '1.2.0'
  appType: 'standard'
  procType: 'native'
  processProvider:
    name: 'JVMOsProcessProviderImpl'
    version: '1.0.0'
    executable:
      start:
        path: '${ont_app_path}/bin'
        startJvmCommand: 'java -jar -Dlog.dir=${ont_app_logs_path} -Dserver.servlet.session.cookie.path=/_by_name/onteon-demo-app-cookbook-native/cookbook -Dserver.port=${ont_port_1}'
        successLine: 'Spring Boot properly started'
        executableFileName: 'app.war'
  placeHolder:
    name: 'PlaceHolderManagerImpl'
    version: '1.0.0'
    filesToReplace:
    variables:
  serviceRepository:
    healthCheckUrl: 'http://${address}:${ont_port_1}/cookbook/'
    entities:
      - entity:
          priority: 1
          port: ${ont_port_1}
          protocol:
            type: 'HTTP'
            version: '1.1'
          isExternal: true
          isInternal: true

You can also store logs in subdirectories.

The second condition is that your log files must end with '*.json' extension.

The last condition is that your logs must be in json format, with obligatory '@timestamp' field, e.q.:

{"level":"INFO","message":"Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@48720dcf, org.springframework.security.web.context.SecurityContextPersistenceFilter@16bc97b9, org.springframework.security.web.header.HeaderWriterFilter@67620d80, org.springframework.web.filter.CorsFilter@ad9e63e, org.springframework.security.web.authentication.logout.LogoutFilter@4a28852d, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@b8d8fb7, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@6706657b, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@28728558, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@2f65c341, org.springframework.security.web.session.SessionManagementFilter@67a2fb00, org.springframework.security.web.access.ExceptionTranslationFilter@75f1c170, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@793942d9]","context":"default","@timestamp":"1647507283691","logger_name":"org.springframework.security.web.DefaultSecurityFilterChain","thread_name":"main"}
{"level":"INFO","message":"Adding welcome page: ServletContext resource [/index.html]","context":"default","@timestamp":"1647507283962","logger_name":"org.springframework.boot.autoconfigure.web.servlet.WelcomePageHandlerMapping","thread_name":"main"}
{"level":"INFO","message":"Tomcat started on port(s): 10000 (http) with context path '/cookbook'","context":"default","@timestamp":"1647507284144","logger_name":"org.springframework.boot.web.embedded.tomcat.TomcatWebServer","thread_name":"main"}
{"level":"INFO","message":"Started OnteonDemoAppCookbookApplication in 8.528 seconds (JVM running for 9.048)","context":"default","@timestamp":"1647507284154","logger_name":"tech.onteon.demoapp.microservice.onteondemoappcookbook.OnteonDemoAppCookbookApplication","thread_name":"main"}
{"level":"INFO","message":"Spring Boot properly started","context":"default","@timestamp":"1647507284157","logger_name":"tech.onteon.demoapp.microservice.onteondemoappcookbook.configuration.WebMvcConfiguration","thread_name":"main"}
{"level":"INFO","message":"Initializing Spring DispatcherServlet 'dispatcherServlet'","context":"default","@timestamp":"1647507286059","logger_name":"org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/cookbook]","thread_name":"http-nio-10000-exec-1"}
{"level":"INFO","message":"Initializing Servlet 'dispatcherServlet'","context":"default","@timestamp":"1647507286060","logger_name":"org.springframework.web.servlet.DispatcherServlet","thread_name":"http-nio-10000-exec-1"}
{"level":"INFO","message":"Completed initialization in 2 ms","context":"default","@timestamp":"1647507286062","logger_name":"org.springframework.web.servlet.DispatcherServlet","thread_name":"http-nio-10000-exec-1"}

Viewing logs

To see logs go to http://<sonario-address>:8100/sonario-kibana, then go to Discover and choose index pattern to onteon-logs*. Here you can set fields that you want to see, and filter logs.

logs