config: launch ifmap-server with append to log for logrotate to work right

Bug #1438452 reported by Hampapur Ajay
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Fix Committed
Medium
Hampapur Ajay
R2.0
Fix Committed
Medium
Hampapur Ajay
R2.1
Fix Committed
Medium
Hampapur Ajay
OpenContrail
Fix Committed
Medium
Unassigned

Bug Description

Logrotation of ifmap-server-console.log is incorrect. After every rotation the new file
does not truncate even though it has below directives. Instead new file has leading zeros (see hexdump)
followed by new messages at the old offset. To fix we need to do below(append instead of write) in
/usr/bin/ifmap-server script.

java -cp ./lib/ -jar ./irond.jar >> /var/log/contrail/ifmap-server-console.log 2>&1
instead of
java -cp ./lib/ -jar ./irond.jar > /var/log/contrail/ifmap-server-console.log 2>&1

root@contrail-all-in-one-trusty-r201:/var/log/contrail# vi /etc/logrotate.d/ifmap-server
/var/log/contrail/ifmap-server.log
/var/log/contrail/ifmap-server-raw.log
/var/log/contrail/ifmap-server-console.log
{
  daily
  missingok
  compress
  delaycompress
  notifempty
  copytruncate
}

root@contrail-all-in-one-trusty-r201:/var/log/contrail# logrotate -f /etc/logrotate.d/ifmap-server
root@contrail-all-in-one-trusty-r201:/var/log/contrail# ls -lrt
<snip>
-rw-r--r-- 1 contrail contrail 15758455 Mar 30 22:48 ifmap-server-console.log.1
-rw-r--r-- 1 contrail contrail 15866265 Mar 30 22:48 ifmap-server-console.log

root@contrail-all-in-one-trusty-r201:/var/log/contrail# hexdump -C ifmap-server-console.log | less
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00f07470 00 00 00 00 00 00 00 32 30 31 35 2d 30 33 2d 33 |.......2015-03-3|
00f07480 30 20 32 32 3a 34 38 3a 35 33 2c 36 38 35 20 5b |0 22:48:53,685 [|

Tags: config
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : master

Review in progress for https://review.opencontrail.org/8742
Submitter: Hampapur Ajay (<email address hidden>)

tags: added: config
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/8742
Committed: http://github.org/Juniper/contrail-packages/commit/ab71b8d502fd6c34e439c82af931dd5a559a34d1
Submitter: Zuul
Branch: master

commit ab71b8d502fd6c34e439c82af931dd5a559a34d1
Author: Hampapur Ajay <email address hidden>
Date: Mon Mar 30 16:09:20 2015 -0700

config: append to console redirected file of ifmap to work with logrotate

Avoid exclusive lock on file so it can be truncated by logrotate (see
http://unix.stackexchange.com/questions/46549/logrotate-not-truncating-open-file)

Reproduced + verified fix with forced logrotation.

Closes-Bug: #1438452
Change-Id: Ic6f4361770786d9ec484fcb109272d62a9884a78

Changed in juniperopenstack:
status: New → Fix Committed
Changed in opencontrail:
status: New → Fix Committed
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : R2.1

Review in progress for https://review.opencontrail.org/8961
Submitter: Hampapur Ajay (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : R2.0

Review in progress for https://review.opencontrail.org/8962
Submitter: Hampapur Ajay (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/8961
Committed: http://github.org/Juniper/contrail-packages/commit/2ba5cc0585ca9b1c293acf30b4b6e2d1f683e8e2
Submitter: Zuul
Branch: R2.1

commit 2ba5cc0585ca9b1c293acf30b4b6e2d1f683e8e2
Author: Hampapur Ajay <email address hidden>
Date: Mon Mar 30 16:09:20 2015 -0700

config: append to console redirected file of ifmap to work with logrotate

Avoid exclusive lock on file so it can be truncated by logrotate (see
http://unix.stackexchange.com/questions/46549/logrotate-not-truncating-open-file)

Reproduced + verified fix with forced logrotation.

Closes-Bug: #1438452
Change-Id: Ic6f4361770786d9ec484fcb109272d62a9884a78
(cherry picked from commit ab71b8d502fd6c34e439c82af931dd5a559a34d1)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Reviewed: https://review.opencontrail.org/8962
Committed: http://github.org/Juniper/contrail-packages/commit/a1f21db944226b6d2f38b3abca01d5729e720bb9
Submitter: Zuul
Branch: R2.0

commit a1f21db944226b6d2f38b3abca01d5729e720bb9
Author: Hampapur Ajay <email address hidden>
Date: Mon Mar 30 16:09:20 2015 -0700

config: append to console redirected file of ifmap to work with logrotate

Avoid exclusive lock on file so it can be truncated by logrotate (see
http://unix.stackexchange.com/questions/46549/logrotate-not-truncating-open-file)

Reproduced + verified fix with forced logrotation.

Closes-Bug: #1438452
Change-Id: Ic6f4361770786d9ec484fcb109272d62a9884a78
(cherry picked from commit ab71b8d502fd6c34e439c82af931dd5a559a34d1)

Changed in juniperopenstack:
importance: Undecided → Medium
Changed in opencontrail:
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.