Scroll to navigation

AMINERREMOTECONTROL(1) logdata-anomaly-miner User Man AMINERREMOTECONTROL(1)

NAME

AMinerRemoteControl - lightweight tool for log checking, log analysis

SYNOPSIS

AMinerRemoteControl --ControlSocket socket [--Exec command] [--ExecFile file] [--Data data] [--StringResponse]

DESCRIPTION

This manual page documents briefly the AMinerRemoteControl command. The command executes arbitrary remote control commands in a running AMiner child process. As child process is usually running with lowered privileges or SELinux/AppArmor confinement, you may observe unexpected results when accessing resources outside the child process, e.g. files. For more details see also packaged documentation at /usr/share/doc/logdata-anomaly-miner.

Example usecases:

Print a property of the running AMinerConfig:

/usr/bin/AMinerRemoteControl --Data '["LogResourceList"]' --Exec ' print_config_property(analysis_context, "%s" % remote_control_data[0])'

Print the complete AMinerConfig:

/usr/bin/AMinerRemoteControl --Exec 'print_current_config(analysis_context)'

Print a property of the running AMinerConfig, change it and confirm the changed value by printing it again:

/usr/bin/AMinerRemoteControl --Data '["Resources.MaxMemoryUsage", -1]' --Exec ' print_config_property(analysis_context, "%s" % remote_control_data[0])' --Exec 'change_config_property(analysis_context, "%s" % remote_control_data[0], remote_control_data[1])' --Exec ' print_config_property(analysis_context, "%s" % remote_control_data[0])'

OPTIONS

with long options starting with two dashes ('-'). A summary of options is included below. For a complete description, see the info(1) files.

--ControlSocket socket

Specify the Unix domain remote control socket path, otherwise /var/run/aminer-remote.socket is used. The socket is opened by AMiner when 'RemoteControlSocket' feature is enabled in configuration. As the socket is of SOCK_STREAM type, it may also be forwarded via any other stream forwarders, e.g. socat (see UNIX-CONNECT and UNIX-LISTEN) and SSH (see LocalForward, DynamicForward). Access control is only done by file system permissions (DAC) of the socket, so make sure not to widen the access on error.

--Exec command

For each --Exec option, the next argument is sent in a separate remote execution request using additional execution data (see --Data). The command is executed in a separate execution namespace with only some variables added to the local namespace, e.g. execution data is available as 'remote_control_data'. When setting the local variable 'remoteControlResponse' within the executed command, the object is serialized using json and sent back in the response.

--ExecFile file

For each --ExecFile option, the named file is loaded and content submitted in the very same way as if --Exec parameter with content as string would have been used.

--Data data

This parameter defines a json string defining Python objects, that will be sent with all subsequent --Exec operations until changed again using another --Data option. Take into account, that there are size limits for the request, very large data objects may exceed those limits. The execution context will expose the data as variable 'remote_control_data'.

--StringResponse

When set, AMinerRemoteControl will not pass the result to repr. The returned object is just converted to a plain string via str(object) and the result is printed to avoid escaping of quotation marks, newlines, .... WARNING: This might be insecure: without escaping the printed data may contain terminal control sequences to exploit vulnerabilities or misconfiguration of your terminal to execute code with privileges of terminal or the process calling AMinerRemoteControl (usually root).

Commands

change_config_property(analysis_context,property_name,value)

This method allows you to change properties from the AMinerConfig at runtime. For every property to be changed this method must be used. The method prints "property_name changed to value successfully." if the changes were successful and an individual message if the changes failed.

Read more about which properties can be changed in the Valid Property Names section.

change_attribute_of_registered_analysis_component(analysis_context,component_name,attribute,value)

This method allows you to change attributes from components of the AMinerConfig at runtime. For every attribute to be changed this method must be used. The method prints "component_name.attribute changed to value successfully. " if the changes were successful and an individual message if the changes failed. The type of the new value must be the same like the old value of the component_name.attribute

example: AMinerRemoteControl --Exec "change_attribute_of_registered_analysis_component(analysis_context, 'NewMatchPath', 'auto_include_flag', False)"

rename_registered_analysis_component(analysis_context,old_component_name,new_component_name)

Renames the component from the old_component_name to new_component_name. Therefore the component with the old_component_name is deleted from the registered components and registered with the new_component_name.

example: AMinerRemoteControl --Exec "rename_registered_analysis_component(analysis_context,'NewMatchPath','NewMatchPathDetector')"

add_handler_to_atom_filter_and_register_analysis_component(analysis_context,atom_handler,component,component_name)

Adds the component to the atom_filter and registers it with the component_name.

example: AMinerRemoteControl --Exec "add_handler_to_atom_filter_and_register_analysis_component(analysis_context, 'AtomFilter', NewMatchPathDetector(analysis_context.aminer_config, analysis_context.atomizer_factory.atom_handler_list, auto_include_flag=True), 'NewMatchPathDet')"

print_config_property(analysis_context,property_name)

Prints the property with the property_name from the current AMinerConfig.

example: AMinerRemoteControl --Exec "print_config_property(analysis_context,'NewMatchPath')"

print_attribute_of_registered_analysis_component(analysis_context,component_name, attribute)

Prints the attribute of the component with the component_name.

example: AMinerRemoteControl --Exec "print_attribute_of_registered_analysis_component(analysis_context,'NewMatchPath', 'auto_include_flag')"

print_current_config(analysis_context)

Prints the current AMinerConfig. It is strongly recommended to use the --StringResponse parameter for better readability.

example: AMinerRemoteControl --Exec "print_current_config(analysis_context)" --StringResponse

save_current_config(analysis_context,destination_file)

Saves the current AMinerConfig into destination_file. destination_file must have write permissions by the AMinerRemoteControl process or it returns an PermissionError.

example: AMinerRemoteControl --Exec "save_current_config(analysis_context,'/tmp/config.py')"

whitelist_event_in_component(analysis_context,component_name,event_data,whitelisting_data=None)

Whitelists a path from event_data with the whitelistEvent-method from the corresponding class of the component with the component_name. Only the following classes support whitelisting: EnhancedNewMatchPathValueComboDetector , MissingMatchPathValueDetector, NewMatchPathDetector and NewMatchPathValueComboDetector. For most of the components no whitelisting_data is needed and the event_data is a path. The NewMatchPathDetector supports a list of multiple pathes. The MissingMatchPathValueComboDetector needs an integer as whitelisting_data. A positive value sets the interval in seconds to the value. -1 sets the interval to the default value of 3600. A negative value removes the missingMatchPath. Please read the examples of this method to use the correct parameters.

example: AMinerRemoteControl --Exec "whitelist_event_in_component(analysis_context,'EnhancedNewMatchPathValueComboDetector','new/path')"

example: AMinerRemoteControl --Exec "whitelist_event_in_component(analysis_context,'MissingMatchPathValueDetector','new/path',-11)"

example: AMinerRemoteControl --Exec "whitelist_event_in_component(analysis_context,'NewMatchPathDetector',['new/path'])"

example: AMinerRemoteControl --Exec "whitelist_event_in_component(analysis_context,'NewMatchPathValueComboDetector','new/path')"

dump_events_from_history(analysis_context,history_component_name,dump_event_id)

This method returns the string representation of a history event with the dump_event_id. If no event with the dump_event_id could be found, the message "FAILURE: the event with dump_event_id could not be found!" is returned. history_component_name is the registered component of the class VolatileLogarithmicBackoffEventHistory.

example: AMinerRemoteControl --Exec "dump_events_from_history(analysis_context,'VolatileLogarithmicBackoffEventHistory',12)"

ignore_events_from_history(analysis_context,history_component_name,event_ids)

This method deletes the events with the event_ids from the history. history_component_name is the registered component of the class VolatileLogarithmicBackoffEventHistory. The number of deleted events is returned.

example: AMinerRemoteControl --Exec "ignore_events_from_history(analysis_context,'VolatileLogarithmicBackoffEventHistory',[12,13,15])"

list_events_from_history(analysis_context,history_component_name,max_event_count=None)

This method lists max_event_count events from the history. history_component_name is the registered component of the class VolatileLogarithmicBackoffEventHistory. If max_event_count is None, all events from the history are returned.

example: AMinerRemoteControl --Exec "list_events_from_history(analysis_context,'VolatileLogarithmicBackoffEventHistory',600)"

whitelist_events_from_history(analysis_context,history_component_name,id_spec_list,whitelisting_data=None)

This method whitelists the events with the ids in theid_spec_list from the history. history_component_name is the registered component of the class VolatileLogarithmicBackoffEventHistory. The whitelisting response is returned.

example: AMinerRemoteControl --Exec "whitelist_events_from_history(analysis_context,'VolatileLogarithmicBackoffEventHistory',[12,13,15])"

Valid Property Names

MailAlerting.TargetAddress

Value: 'E-Mail Address'

Example: AMinerRemoteControl --Exec "change_config_property(analysis_context, 'MailAlerting.TargetAddress', 'root@localhost')"

Define a target e-mail address to send alerts to. When undefined, no e-mail notification hooks are added.

MailAlerting.FromAddress

Value: 'E-Mail Address'

Example: AMinerRemoteControl --Exec "change_config_property(analysis_context, 'MailAlerting.FromAddress', 'root@localhost')"

Sender address of e-mail alerts. When undefined, "sendmail" implementation on host will decide, which sender address should be used.

MailAlerting.SubjectPrefix

Value: 'String'

Example: AMinerRemoteControl --Exec "change_config_property(analysis_context, 'MailAlerting.SubjectPrefix', 'AMiner Alerts:')"

Define, which text should be prepended to the standard aminer subject. Defaults to "AMiner Alerts:"

MailAlerting.EventCollectTime

Value: Seconds (Integer)

Example: AMinerRemoteControl --Exec "change_config_property(analysis_context, 'MailAlerting.EventCollectTime', 10)"

Define how many seconds to wait after a first event triggered the alerting procedure before really sending out the e-mail. In that timespan, events are collected and will be sent all using a single e-mail. Defaults to 10 seconds.

MailAlerting.MinAlertGap

Value: Seconds (Integer)

Example: AMinerRemoteControl --Exec "change_config_property(analysis_context, 'MailAlerting.MinAlertGap', 600)"

Define the minimum time between two alert e-mails in seconds to avoid spamming. All events during this timespan are collected and sent out with the next report. Defaults to 600 seconds.

MailAlerting.MaxAlertGap

Value: Seconds (Integer)

Example: AMinerRemoteControl --Exec "change_config_property(analysis_context, 'MailAlerting.MaxAlertGap', 1000)"

Define the maximum time between two alert e-mails in seconds. When undefined this defaults to "MailAlerting.MinAlertGap". Otherwise this will activate an exponential backoff to reduce messages during permanent error states by increasing the alert gap by 50% when more alert-worthy events were recorded while the previous gap time was not yet elapsed.

MailAlerting.MaxEventsPerMessage

Value: Number of messages (Integer)

Example: AMinerRemoteControl --Exec "change_config_property(analysis_context, 'MailAlerting.MaxEventsPerMessage', 1000)"

Define how many events should be included in one alert mail at most. This defaults to 1000.

LogPrefix

Value: 'String'

Example: AMinerRemoteControl --Exec "change_config_property(analysis_context, 'LogPrefix', ' Original log line: ')"

Most analysis components implement the outputLogLine-property, which is True by default. Define a prefix to the original captured log lines. This defaults to ''

Resources.MaxMemoryUsage

Value: 'Allowed RAM usage in Megabytes (Integer: 32-maxSystemRAM)'

Example: AMinerRemoteControl --Exec "change_config_property(analysis_context, 'Resources.MaxMemoryUsage', -1)"

This property limits the maximal possible RAM in MB which the AMiner process can use. Be careful at choosing the value, as a shortage of memory causes a MemoryError. This defaults to -1, which means that there is no limit.

Resources.MaxCpuPercentUsage

Value: Integer: 1-100

Example: AMinerRemoteControl --Exec "change_config_property(analysis_context, 'Resources.MaxCpuPercentUsage', 30)

By limiting the AMiner process to a fraction of possible CPU usage the system can not longer be overloaded by it. The percentages can only be full numbers and must be between 1 and 100.

FILES

/var/run/aminer-remote.socket

This is the default remote control socket used when not changed using the --ControlSocket option.

BUGS

Report bugs via your distribution's bug tracking system. For bugs in the the software trunk, report via at https://bugs.launchpad.net/logdata-anomaly-miner/+filebug.

SEE ALSO

AMiner(1)

AUTHOR

Markus Wurzenberger <markus.wurzenberger@ait.ac.at>

Wrote this manpage for the Debian system.

COPYRIGHT

Copyright © 2016 Markus Wurzenberger

This manual page was written for the Debian system (and may be used by others).

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3.

On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL.

06/30/2020 logdata-anomaly-miner