templates/cassandra/config/rubber/role/cassandra/log4j-server.properties in rubber-2.0.0 vs templates/cassandra/config/rubber/role/cassandra/log4j-server.properties in rubber-2.0.1
- old
+ new
@@ -1,7 +1,8 @@
<%
@path = "#{rubber_env.cassandra_dir}/conf/log4j-server.properties"
+ graylog_server = rubber_instances.for_role("graylog_server").first
%>
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -17,15 +18,15 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-# for production, you should probably set the root to INFO
-# and the pattern to %c instead of %l. (%l is slower.)
+# for production, you should probably set pattern to %c instead of %l.
+# (%l is slower.)
# output messages into a rolling log file as well as stdout
-log4j.rootLogger=INFO,stdout,R
+log4j.rootLogger=INFO,stdout,R,graylog2
# stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p %d{HH:mm:ss,SSS} %m%n
@@ -36,9 +37,21 @@
log4j.appender.file.maxBackupIndex=50
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%5p [%t] %d{ISO8601} %F (line %L) %m%n
# Edit the next line to point to your logs directory
log4j.appender.R.File=<%= rubber_env.cassandra_log_dir %>/system.log
+
+<% if graylog_server %>
+# graylog - see https://github.com/t0xa/gelfj
+log4j.appender.graylog2=org.graylog2.log.GelfAppender
+log4j.appender.graylog2.graylogHost=<%= graylog_server.full_name %>
+log4j.appender.graylog2.graylogPort=<%= rubber_env.graylog_server_port %>
+log4j.appender.graylog2.originHost=<%= rubber_env.host %>
+log4j.appender.graylog2.facility=cassandra
+log4j.appender.graylog2.extractStacktrace=true
+log4j.appender.graylog2.addExtendedInformation=true
+# log4j.appender.graylog2.additionalFields={'environment': 'DEV', 'application': 'MyAPP'}
+<% end %>
# Application logging options
#log4j.logger.com.facebook=DEBUG
#log4j.logger.com.facebook.infrastructure.gms=DEBUG
#log4j.logger.com.facebook.infrastructure.db=DEBUG