Puppet Class: elasticsearch::log::hot_threads

Defined in:
modules/elasticsearch/manifests/log/hot_threads.pp

Overview

Class: elasticsearch::log::hot_threads

Install a cron job to log the hot threads.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'modules/elasticsearch/manifests/log/hot_threads.pp', line 5

class elasticsearch::log::hot_threads {
    require_package('python3-yaml')

    file { '/etc/elasticsearch_hot_threads.d':
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }

    $script_name = 'elasticsearch_hot_threads_logger.py'
    $script = "/usr/local/bin/${script_name}"
    file { $script:
        source => "puppet:///modules/elasticsearch/${script_name}",
        mode   => '0555',
    }

    # Old log location
    file { '/var/log/elasticsearch/elasticsearch_hot_threads.log':
        ensure => absent
    }
    # This log file contains only exceptions raised while
    # executing. See hot_threads_cluster for individual cluster
    # log file locations.
    $log = '/var/log/elasticsearch/elasticsearch_hot_threads_errors.log'
    cron { 'elasticsearch-hot-threads-log':
        command => "${script} > /dev/null 2>&1",
        #So the destination directory exists
        require => [Package['elasticsearch'], File[$script]],
        user    => 'elasticsearch',
        minute  => '*/5',
    }

    # The logrotate configuration for Elasticsearch will roll these logs just
    # fine.
}