Logging
Learn how to transform incoming data in an Elasticsearch Ingest Pipeline.
Logging
logBox = {
// Define Appenders
appenders = {
console = {
class="coldbox.system.logging.appenders.ConsoleAppender"
},
logstash = {
class="cbelasticsearch.models.logging.LogstashAppender",
// The log level to use for this appender - in this case only errors and above are logged to Elasticsearch
levelMax = "ERROR",
// Appender configuration
properties = {
// The pattern used for the data stream configuration. All new indices with this pattern will be created as data streams
"dataStreamPattern" : "logs-coldbox-*",
// The data stream name to use for this appenders logs
"dataStream" : "logs-coldbox-logstash-appender",
// The ILM policy name to create for transitioning/deleting data
"ILMPolicyName" : "cbelasticsearch-logs",
// The name of the component template to use for the index mappings
"componentTemplateName" : "cbelasticsearch-logs-mappings",
// The name of the index template whic the data stream will use
"indexTemplateName" : "cbelasticsearch-logs",
// Retention of logs in number of days
"retentionDays" : 365,
// an optional lifecycle full policy https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-put-lifecycle.html
"lifecyclePolicy" : javacast( "null", 0 ),
// The name of the application which will be transmitted with the log data and used for grouping
"applicationName" : "My Application name",
// A release version to use for your logs
"releaseVersion" : "1.0.0",
// The number of shards for the backing data stream indices
"indexShards" : 1,
// The number of replicas for the backing indices
"indexReplicas" : 0,
// The max shard size at which the hot phase will rollover data
"rolloverSize" : "10gb",
// Whether to migrate any indices used in v2 of this module over to data streams - only used if an `index` key ( v2 config ) is provided to the properties
"migrateIndices" : false,
// Whether to allow log events to fail quietly. When turned on, any errors received when saving log entries will not throw but will be logged out to other appenders
"throwOnError" : true
}
}
},
// Root Logger - appends into messages to all appenders - except those with a specified `levelMax` like above
root = { levelmax="INFO", appenders="*" }
};Detached Appenders
Creating a Detached Appender
Logging a single message
Logging one or more raw formatted messages
Last updated
Was this helpful?