Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-14625

[GSS](7.1.z) UNDERTOW-1336 - access-log rotates to a new file name with an incorrect date string when the rotation happens after restarting the instance

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.1.3.CR1, 7.1.3.GA
    • 7.1.1.GA
    • Undertow
    • None
    • CR1
    • Hide

      Enable use-server-log and use the rotation feature provided by logging subsystem:

      # Configure `<access-log>` with setting `use-server-log` attribute to true:
      /subsystem=undertow/server=default-server/host=default-host/setting=access-log:add()
      /subsystem=undertow/server=default-server/host=default-host/setting=access-log:write-attribute(name=use-server-log, value=true)
      # Configure a custom handler for access logging in logging subsystem: 
      /subsystem=logging/pattern-formatter=access-log-formatter:add(pattern="%s%n")
      /subsystem=logging/periodic-rotating-file-handler=access-log:add(autoflush=true, append=true, named-formatter=access-log-formatter, suffix=".yyyy-MM-dd", file={path=access_log, relative-to=jboss.server.log.dir})
      /subsystem=logging/logger=io.undertow.accesslog:add(handlers=[access-log], use-parent-handlers=false)
      :reload
      
      Show
      Enable use-server-log and use the rotation feature provided by logging subsystem: # Configure `<access-log>` with setting `use-server-log` attribute to true : /subsystem=undertow/server= default -server/host= default -host/setting=access-log:add() /subsystem=undertow/server= default -server/host= default -host/setting=access-log:write-attribute(name=use-server-log, value= true ) # Configure a custom handler for access logging in logging subsystem: /subsystem=logging/pattern-formatter=access-log-formatter:add(pattern= "%s%n" ) /subsystem=logging/periodic-rotating-file-handler=access-log:add(autoflush= true , append= true , named-formatter=access-log-formatter, suffix= ".yyyy-MM-dd" , file={path=access_log, relative-to=jboss.server.log.dir}) /subsystem=logging/logger=io.undertow.accesslog:add(handlers=[access-log], use-parent-handlers= false ) :reload
    • Hide
      1. Start JBoss and enable access-log:
        /subsystem=undertow/server=default-server/host=default-host/setting=access-log:add()
        
      2. Send request, change date and restart JBoss instance like:
        sudo date -s "2018-04-20 01:00"
        curl -v http://localhost:8080/
        sudo date -s "2018-04-21 01:00"
        curl -v http://localhost:8080/
        sudo date -s "2018-04-22 01:00"
        // Restart JBoss instance here 
        curl -v http://localhost:8080/
        sudo date -s "2018-04-23 01:00"
        curl -v http://localhost:8080/
        
      3. Check the rotate access log files:
        $ ls -l standalone/log/access_log*
        -rw-rw-r--. 1 <user> <group> 69 Apr 20  2018 standalone/log/access_log.2018-04-20.log
        -rw-rw-r--. 1 <user> <group> 69 Apr 22  2018 standalone/log/access_log.2018-04-22-1.log
        -rw-rw-r--. 1 <user> <group> 69 Apr 21  2018 standalone/log/access_log.2018-04-22.log
        -rw-rw-r--. 1 <user> <group> 69 Apr 23  2018 standalone/log/access_log.log
        
      Show
      Start JBoss and enable access-log: /subsystem=undertow/server= default -server/host= default -host/setting=access-log:add() Send request, change date and restart JBoss instance like: sudo date -s "2018-04-20 01:00" curl -v http: //localhost:8080/ sudo date -s "2018-04-21 01:00" curl -v http: //localhost:8080/ sudo date -s "2018-04-22 01:00" // Restart JBoss instance here curl -v http: //localhost:8080/ sudo date -s "2018-04-23 01:00" curl -v http: //localhost:8080/ Check the rotate access log files: $ ls -l standalone/log/access_log* -rw-rw-r--. 1 <user> <group> 69 Apr 20 2018 standalone/log/access_log.2018-04-20.log -rw-rw-r--. 1 <user> <group> 69 Apr 22 2018 standalone/log/access_log.2018-04-22-1.log -rw-rw-r--. 1 <user> <group> 69 Apr 21 2018 standalone/log/access_log.2018-04-22.log -rw-rw-r--. 1 <user> <group> 69 Apr 23 2018 standalone/log/access_log.log
    • EAP 7.1.3

      Undertow DefaultAccessLogReceiver initilizes a new rotate file name with the current date at the start-up. Therefore, access-log rotates to a new file name with an incorrect date string when the access-log rotation happens after restaring the instance.

      For example, if the access-log rotation happened after restarting JBoss instance at 2018/04/22, access_log for 2018/04/21 would be rotated to access_log.2018-04-22.log and access_log for 2018/04/22 would be rotated to access_log.2018-04-22-1.log:

      $ ls -l standalone/log/access_log*
      -rw-rw-r--. 1 <user> <group> 69 Apr 20  2018 standalone/log/access_log.2018-04-20.log
      -rw-rw-r--. 1 <user> <group> 69 Apr 22  2018 standalone/log/access_log.2018-04-22-1.log // this should be access_log.2018-04-22.log
      -rw-rw-r--. 1 <user> <group> 69 Apr 21  2018 standalone/log/access_log.2018-04-22.log // this should be access_log.2018-04-21.log
      -rw-rw-r--. 1 <user> <group> 69 Apr 23  2018 standalone/log/access_log.log
      

              rhn-support-mmiura Masafumi Miura
              rhn-support-mmiura Masafumi Miura
              Peter Mackay Peter Mackay
              Peter Mackay Peter Mackay
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: