Class: Flydata::Helper::Action::SendLogs
- Inherits:
-
BaseAction
- Object
- BaseAction
- Flydata::Helper::Action::SendLogs
- Includes:
- Util::FileUtil
- Defined in:
- lib/flydata/helper/action/send_logs.rb
Constant Summary collapse
- DEFAULT_NUM_OF_LINES =
100
Instance Attribute Summary
Attributes inherited from BaseAction
Instance Method Summary collapse
- #execute(opts = {}) ⇒ Object
-
#initialize(config) ⇒ SendLogs
constructor
A new instance of SendLogs.
Methods included from Util::FileUtil
#read_line, #tail, #write_line
Methods inherited from BaseAction
Constructor Details
Instance Method Details
#execute(opts = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/flydata/helper/action/send_logs.rb', line 18 def execute(opts = {}) num_of_lines = DEFAULT_NUM_OF_LINES action_id = opts[:id] begin num_of_lines = opts[:config_hash][:num_of_lines].to_i rescue # Use default number of lines if config is nil, mal-formed etc end log_info("Sending logs - num_of_lines:#{num_of_lines}") tailed_lines = tail(FLYDATA_LOG, num_of_lines) @api_client.agent.send_logs(action_id, tailed_lines) end |