Created
August 10, 2015 14:03
-
-
Save aodj/d3feade832614ca42f6e to your computer and use it in GitHub Desktop.
Example Heka configuration to get some metadata items from the `ec2metadata` tool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ec2_metadata] | |
type = "ProcessInput" | |
ticker_interval = 10 | |
decoder = "ec2_metadata_decoder" | |
[ec2_metadata.command.0] | |
bin = "/usr/bin/ec2metadata" | |
args = ["--ami-id", "--instance-id", "--instance-type", "--local-ipv4"] | |
[ec2_metadata_decoder] | |
type = "PayloadRegexDecoder" | |
log_errors = true | |
match_regex = '^(?P<AmiID>\S+)\n(?P<InstanceID>\S+)\n(?P<InstanceType>\S+)\n(?P<InstanceIPV4>\S+)' | |
[ec2_metadata_decoder.message_fields] | |
Type = "ec2metadata" | |
ami_id = "%AmiID%" | |
instance_id = "%InstanceID%" | |
instance_type = "%InstanceType%" | |
instance_ipv4|ipv4 = "%InstanceIPV4%" | |
[ec2_metadata_encoder] | |
type = "ESJsonEncoder" | |
index = "%{Type}" | |
type_name = "%{Hostname}" | |
es_index_from_timestamp = true | |
fields = ["DynamicFields", "Uuid", "Logger", "Hostname"] | |
dynamic_fields = ["ami_id", "instance_id", "instance_type", "instance_ipv4"] | |
[ec2_metadata_encoder.field_mappings] | |
Timestamp = "@timestamp" | |
[ESLogstashV0Encoder] | |
[out:stdout] | |
type = "LogOutput" | |
message_matcher = "TRUE" | |
encoder = "ec2_metadata_encoder" | |
payload_only = false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
ec2metadata
tool can be found here