Method: Common::Utils#get_vm_id
- Defined in:
- lib/fluent/plugin/common.rb
#get_vm_id(platform, vm_id) ⇒ Object
-
Return the value if it is explicitly set in the config already.
-
If not, try to retrieve it by calling metadata servers directly.
183 184 185 186 187 188 189 190 191 |
# File 'lib/fluent/plugin/common.rb', line 183 def get_vm_id(platform, vm_id) vm_id ||= (platform, 'instance/id') if platform == Platform::GCE vm_id ||= (platform)['instanceId'] if platform == Platform::EC2 vm_id rescue StandardError => e @log.error 'Failed to obtain vm_id: ', error: e end |