Skip to content

Instantly share code, notes, and snippets.

Ry Biesemeyer yaauie

Block or report user

Report or block yaauie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yaauie
yaauie / tag-when-fields-over-threshold.logstash-filter-ruby.rb
Last active Jun 1, 2020
Logstash: tag when field count over threshold
View tag-when-fields-over-threshold.logstash-filter-ruby.rb
###############################################################################
# tag-when-fields-over-threshold.logstash-filter-ruby.rb
# ---------------------------------
# A script for a Logstash Ruby Filter to tag an event when it has "too many"
# fields, with a configurable threshold.
###############################################################################
#
# Copyright 2020 Ry Biesemeyer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
View replace-subset.logstash-filter-ruby.rb
###############################################################################
# replace-subset.logstash-filter-ruby.rb
# ---------------------------------
# A script for a Logstash Ruby Filter to replace an event's contents with a
# subset that exists as an object in a field.
###############################################################################
#
# Copyright 2020 Ry Biesemeyer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@yaauie
yaauie / hello.jscript.bat
Created May 6, 2011
A Polyglot for jscript in batch
View hello.jscript.bat
0</* :hello
@ECHO Hello, batch!
@cscript /nologo /E:jscript %~f0 %*
@goto :EOF
*/0;
WScript.Echo('Hello, jscript!');
@yaauie
yaauie / delete-emtpy-nodes.logstash-filter-ruby.rb
Last active Jul 23, 2019
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.
View delete-emtpy-nodes.logstash-filter-ruby.rb
###############################################################################
# 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
#
View processor-hostname.logstash-filter-ruby.rb
filter {
ruby {
path => "${PWD}/processor-hostname.logstash-filter-ruby.rb"
script_params => {
"target" => "@processed-by"
}
}
}
@yaauie
yaauie / pipeline.conf
Last active May 6, 2019
A script for a Logstash Ruby Filter to transpose an array of two-element objects representing key/value tuples into a single hash/map
View pipeline.conf
filter {
# to convert an array of key/value objects into a single unordered
# key/value map, use the included `transpose` script:
ruby {
path => "${PWD}/transpose.logstash-filter-ruby.rb"
script_params => {
source => "[proplist]"
}
}
@yaauie
yaauie / back_pressure_provider.rb
Created Apr 29, 2019
proof-of-concept generic back-pressure provider, enables blocking back-pressure to be controlled outside the code that is performing the actions.
View back_pressure_provider.rb
# The BackPressureProvider allows back-pressure to be applied to non-blocking APIs when those APIs also
# provide hooks for identifying when they _should_ block.
class BackPressureProvider
def initialize(desc, logger)
@desc = desc
@logger = logger
@mutex = Mutex.new
@cond = ConditionVariable.new
@back_pressure_engaged = false
@yaauie
yaauie / cdlp
Last active Mar 4, 2019
Bash/Zsh-compliant utility function that allows you to cd into a local checkout of a Logstash Plugin's source code, whether or not you have previously cloned the repository
View cdlp
#!/usr/bin/env bash
#
# Utility that allows you to cd into a local checkout of a Logstash Plugin's
# source code, whether or not you have previously cloned the repository.
#
# Usage:
# cdlp <type> <qualifier>
#
# Example:
# cdlp output elasticsearch
@yaauie
yaauie / jdbc-informix-windowing.diff
Created Sep 18, 2018
Logstash JDBC Input Plugin: Informix DB Windowing Support Proof-of-Concept
View jdbc-informix-windowing.diff
diff --git a/lib/logstash/plugin_mixins/jdbc.rb b/lib/logstash/plugin_mixins/jdbc.rb
index c9bc547..934a4f1 100644
--- a/lib/logstash/plugin_mixins/jdbc.rb
+++ b/lib/logstash/plugin_mixins/jdbc.rb
@@ -162,6 +162,7 @@ module LogStash::PluginMixins::Jdbc
raise LogStash::ConfigurationError, "#{e}. #{message}"
end
@database = jdbc_connect()
+ @database.extension(:informix_windowing)
@database.extension(:pagination)
@yaauie
yaauie / lucene-list-fields-from-elasticsearch-index-mappings.rb
Created Sep 11, 2018
A quick and very dirty script to list the effective lucene field list from an elasticsearch index mapping
View lucene-list-fields-from-elasticsearch-index-mappings.rb
#!/usr/bin/env ruby
# A quick and very dirty script to list the effective lucene schema from an elasticsearch index mapping
#
# USAGE:
# cat index_mappings.json | lucene-list-fields-from-elasticsearch-index-mappings.rb
# cat cluster_mappings.json | jq '.["index_name"].mappings' | lucene-list-fields-from-elasticsearch-index-mappings.rb
#
#
# Copyright 2018 Ry Biesemeyer (@yaauie)
You can’t perform that action at this time.