Skip to content

Commit

Permalink
Merge pull request Normation#14 from VinceMacBuche/bug_3195/migrate_l…
Browse files Browse the repository at this point in the history
…ogback

Fixes #3195 : Add migration script to add non compliant report logger to...
  • Loading branch information
Kegeruneku committed Jan 21, 2013
2 parents 5b92bb1 + 31a881b commit cf38b2f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rudder-webapp/SOURCES/rudder-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ set -e
# - 2.5.0 : Add "rudder.batch.reports.logInterval" configuration parameter to rudder-web.properties
# - 2.5.0 : Migration DB schema to add gitcommit table, to link a git commit to a modification
# - 2.5.0 : Migration DB schema to add modificationid column to eventLog table
# - 2.5.0 : Update logback.xml in order to have information about non compliant reports
#####################################################################################

# Some variables
Expand Down Expand Up @@ -611,6 +612,12 @@ then
sed -i 's%^ *</configuration>% <logger name="historization" level="info" additivity="false">\n <appender-ref ref="OPSLOG" />\n <!-- comment the following appender if you dont want to have logs about report in both stdout and opslog -->\n <appender-ref ref="STDOUT" />\n </logger>\n </configuration>%' /opt/rudder/etc/logback.xml
fi

# - 2.5.0 : Update logback.xml in order to have information about non compliant reports
if ! cat /opt/rudder/etc/logback.xml | perl -p0e 's/\n//g' | perl -p0e 's/<!--.(?:(?!-->).)*-->//g' | perl -p0e 's/> *</></g' | grep -E '<property name="REPORT_DIR" value="[^"]+" />' > /dev/null
then
sed -i 's%^ *</configuration>% <!-- Here come non compliant reports logger -->\n\n <property name="REPORT_DIR" value="/var/log/rudder/compliance" />\n\n <!--\n A file log appender for exploitation logs about failure reports.\n -->\n <appender name="REPORTLOG" class="ch.qos.logback.core.FileAppender">\n <file>${REPORT_DIR}/non-compliant-reports.log</file>\n <append>true</append>\n <encoder>\n <pattern>\%msg\%n</pattern>\n </encoder>\n </appender>\n\n <logger name="non-compliant-reports" level="info" additivity="false">\n <appender-ref ref="REPORTLOG" />\n <!-- comment the following appender if you dont want to have logs about non compliant reports in both stdout and reportlog -->\n <appender-ref ref="STDOUT" />\n </logger>\n\n</configuration>%' /opt/rudder/etc/logback.xml
fi

# - 2.4.1 : Add the group serialization table (GroupsNodesJoin) to the database
RES=$(su - postgres -c "psql -d rudder -t -c \"select count(1) from pg_class where relname = 'groupsnodesjoin'\"")
if [ $RES -eq 0 ]; then
Expand Down

0 comments on commit cf38b2f

Please sign in to comment.