Skip to content

profile

Profile Logstash processes to ensure they are running and installed properly.

To import...

from dynamite_nsm.services.logstash import profile as logstash_profile

ProcessProfiler

__init__(self) special

Get information about the Logstash service

Source code in dynamite_nsm/services/logstash/profile.py
def __init__(self):
    """
    Get information about the Logstash service
    """
    self.env_file = os.path.join(const.CONFIG_PATH, 'environment')
    self.env_dict = utilities.get_environment_file_dict()
    self.logstash_home = self.env_dict.get('LS_HOME')
    self.logstash_config = self.env_dict.get('LS_PATH_CONF')

    profile.BaseProcessProfiler.__init__(self,
                                         install_directory=self.logstash_home,
                                         config_directory=self.logstash_config,
                                         required_install_files=['bin', 'data', 'lib', 'logstash-core'],
                                         required_config_files=['logstash.yml', 'jvm.options']
                                         )

is_running(self)

Check if Logstash is running

Returns:

Type Description

True, if running

Source code in dynamite_nsm/services/logstash/profile.py
def is_running(self):
    """Check if Logstash is running
    Returns:
        True, if running
    """
    if self.logstash_home:
        try:
            return logstash_process.ProcessManager().status()['running']
        except KeyError:
            return logstash_process.ProcessManager().status()['RUNNING']
    return False