Class: LogStash::Outputs::LogstashAzureBlobOutput::SizeRotationPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/outputs/blob/size_rotation_policy.rb

Overview

a sub class of LogstashAzureBlobOutput sets the rotation policy by size

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(size_file) ⇒ SizeRotationPolicy

initialize the class



9
10
11
12
13
14
15
# File 'lib/logstash/outputs/blob/size_rotation_policy.rb', line 9

def initialize(size_file)
  if size_file <= 0
    raise LogStash::ConfigurationError.new('`size_file` need to be greather than 0')
  end

  @size_file = size_file
end

Instance Attribute Details

#size_fileObject (readonly)

Returns the value of attribute size_file.



7
8
9
# File 'lib/logstash/outputs/blob/size_rotation_policy.rb', line 7

def size_file
  @size_file
end

Instance Method Details

#needs_periodic?Boolean

boolean method

Returns:

  • (Boolean)


23
24
25
# File 'lib/logstash/outputs/blob/size_rotation_policy.rb', line 23

def needs_periodic?
  false
end

#rotate?(file) ⇒ Boolean

boolean method to check if it is time to rotate

Returns:

  • (Boolean)


18
19
20
# File 'lib/logstash/outputs/blob/size_rotation_policy.rb', line 18

def rotate?(file)
  file.size >= size_file
end