Skip to content

Instantly share code, notes, and snippets.

@daenney
Last active February 17, 2016 14:32
Show Gist options
  • Save daenney/d2e760fa6b18c4576747 to your computer and use it in GitHub Desktop.
Save daenney/d2e760fa6b18c4576747 to your computer and use it in GitHub Desktop.
PuppetDB ELK
<configuration>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/var/log/puppetlabs/puppetdb/access.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>access.%d{yyyy-MM-dd}.log.zip</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%a %l %u [%t] "%r" %s %b "%i{Referer}" "%i{User-Agent}"</pattern>
</encoder>
</appender>
<appender-ref ref="FILE" />
</configuration>
input {
file {
path => "/var/log/puppetlabs/puppetdb/access.log"
start_position => "beginning"
sincedb_path => "/var/log/puppetlabs/puppetdb/.sincedb-puppetdb-logstash"
}
file {
path => "/var/log/apache2/${::fqdn}_access_ssl.log"
start_position => "beginning"
sincedb_path => "/var/log/apache2/.sincedb-puppetdb-logstash"
}
}
filter {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
date {
match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
}
}
output {
elasticsearch {
index => "puppetdb_access-%{+YYYY.MM.dd}"
hosts => "YOUR ES HOSTS HERE"
}
}
{
"template" : "puppetdb_access-*",
"mappings" : {
"_default_" : {
"dynamic_templates" : [ {
"string_fields" : {
"mapping" : {
"index" : "analyzed",
"omit_norms" : true,
"type" : "string",
"fields" : {
"raw" : {
"index" : "not_analyzed",
"ignore_above" : 256,
"type" : "string"
}
}
},
"match_mapping_type" : "string",
"match" : "*"
}
} ],
"properties" : {
"bytes" : {
"type" : "integer"
},
"response" : {
"type" : "integer"
},
"@version" : {
"index" : "not_analyzed",
"type" : "string"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment