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
############################################################################### | |
# downcase-field-names.logstash-filter-ruby.rb | |
# --------------------------------- | |
# A script for a Logstash Ruby Filter to transform field names to all lowercase | |
############################################################################### | |
# | |
# Copyright 2020 Ry Biesemeyer | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal |
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
############################################################################### | |
# delete-emtpy-nodes.logstash-filter-ruby.rb | |
# --------------------------------- | |
# A script for a Logstash Ruby Filter to delete empty nodes from an event; by | |
# default, crawls the entire event recursively, but it can be configured to | |
# limit the scope. | |
############################################################################### | |
# | |
# Copyright 2018 Ry Biesemeyer | |
# |
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
# this is an alternate compact function implementation which also removes keys with empty string values | |
# writing the tests for this is left as an excercise to the reader :D | |
def compact(h) | |
h.inject({}) do |result, (k, v)| | |
if v.is_a?(Hash) | |
result[k] = compact(v) | |
elsif v.is_a?(String) | |
result[k] = v unless v.empty? | |
elsif !v.nil? |
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
#!/usr/bin/env ruby | |
# use ./lpv.rb logstash_version plugin_name | |
# | |
# example: | |
# % ./lpv.rb 5.2.0 logstash-output-elasticsearch | |
# logstash-output-elasticsearch 6.2.4 https://github.com/logstash-plugins/logstash-output-elasticsearch/tree/v6.2.4 | |
require 'net/http' |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |