Bug 1222953

Summary: Logshifter configuration parsing stops at a new line
Product: OpenShift Container Platform Reporter: Timothy Williams <tiwillia>
Component: LoggingAssignee: Timothy Williams <tiwillia>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 2.2.0CC: adellape, anli, bleanhar, cryan, jialiu, libra-bugs
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: openshift-origin-logshifter-1.9.1.1-1 Doc Type: Bug Fix
Doc Text:
If a blank line was inserted between options in the logshifter configuration file, any options after the first blank line were not parsed. This bug fix updates logshifter to allow for blank lines when reading configuration, and as a result configuration is parsed when blank lines are present.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-21 19:12:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Timothy Williams 2015-05-19 13:35:21 UTC
Description of problem:
If the logshifter configuration file contains any blank lines "\n" between configuration directives, the directives after the first blank line will be skipped.

Version-Release number of selected component (if applicable):
-

How reproducible:
Always

Steps to Reproduce:
1. On an OpenShift node, insert a blank line between the first and second directive in /etc/openshift/logshifter.conf

2. Set the outputType directive to the non-default value 'syslog'
     outputType=syslog

3. Restart all existing gears or create a new one:
     # oo-admin-ctl-gears restartall

Actual results:
Gear logs are sent to files in ~/app-root/logs since outputType is undefined and defaults to 'file'

Expected results:
Gear logs are sent to syslog, as configured.

Additional info:

Comment 1 Timothy Williams 2015-05-19 13:35:57 UTC
https://github.com/openshift/origin-server/pull/6138

Comment 2 Anping Li 2015-05-21 05:19:48 UTC
Verified and pass in ose-2.2 puddle 2015-05-18.1

1) Enable syslog for gears and node during installation
2) add blank lines "\n" between configuration directives.

3) create app and Restart all gears
[root@node1 ~]# oo-admin-ctl-gears restartall
Stopping gear 555d67544add71f05e000006 ... [ OK ]
Starting gear 555d67544add71f05e000006 ... [ OK ]
Stopping gear 555d67544add71f05e000005 ... [ OK ]
Starting gear 555d67544add71f05e000005 ... [ OK ]

3) check the ~/app-root/logs, there isn't log file
[root@broker ~]# rhc ssh sphp "ls ~/app-root/logs"

4) check the /var/log/message, the operation are recorded.
May 21 13:10:13 node1 openshift-platform[23844]: (23844) Stopping gear 555d67544add71f05e000006 ... [ OK ]
May 21 13:10:13 node1 openshift-platform[23844]: (23844) Stopping gear 555d67544add71f05e000006 ... [ OK ]
May 21 13:10:34 node1 openshift-platform[23844]: (23844) Starting gear 555d67544add71f05e000006 ... [ OK ]
May 21 13:10:34 node1 openshift-platform[23844]: (23844) Starting gear  OK ]

Comment 6 Anping Li 2015-05-22 09:50:20 UTC
I can recreated the problem. However during recreate this bug, I found if outputType is not defined, the default values is syslog, which is different with the origin steps.  So I use outputType = multi to verify this bug.

With following step, without the fix, the logs only written to openshift_gears; in puddle-2-2-2015-05-21, The logs are written to both app-root/logs/php.log and /var/lib/openshift_gears. so move this bug to verified.

My steps is as below:
1)  set CONF_SYSLOG="gears" in openshift.sh and install node
2)  create php applications
3)  insert blank line in logshifter.conf
root@node2 ~]# cat /etc/openshift/logshifter.conf  
queuesize = 1000

inputbuffersize = 4096
outputType = multi
syslogbuffersize = 4096
filebuffersize = 4096
outputTypeFromEnviron = true
filewriterdir = ~/app-root/logs
4). restart ruby193-mcollective and gears.
5). tailf /var/log/openshift_gears, and tailf /var/livb

Comment 8 errata-xmlrpc 2015-07-21 19:12:46 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1463.html