Skip to content

Instantly share code, notes, and snippets.

View binarylogic's full-sized avatar

Ben Johnson binarylogic

View GitHub Profile
@binarylogic
binarylogic / fluent-bit-configmap.yaml
Last active May 15, 2020 14:16
Timber Fluentbit Kubernetes Configuration Files
apiVersion: v1
kind: ConfigMap
metadata:
name: fluent-bit-config
namespace: logging
labels:
k8s-app: fluent-bit
data:
fluent-bit.conf: |
[SERVICE]
@binarylogic
binarylogic / fluent-but-configmap.yaml
Last active February 23, 2019 17:38
Timber Kubernetes Config Map
apiVersion: v1
kind: ConfigMap
metadata:
name: fluent-bit-config
namespace: logging
labels:
k8s-app: fluent-bit
data:
fluent-bit.conf: |
[SERVICE]
@binarylogic
binarylogic / 001_timber.config
Last active February 24, 2019 01:10
Timber.io AWS ElasticBeanstalk configuration file
###
#
# Installation configuration script for sending logs to Timber using fluent-bit
#
# * Docs: https://timber.io/docs/platforms/aws-elastic-beanstalk
# * Support: support@timber.io
#
# To use this file:
#
# *Note:* The in-app instructions will offer copy/paste step-by-step
@binarylogic
binarylogic / keybase.md
Created June 11, 2018 17:03
keybase.md

Keybase proof

I hereby claim:

  • I am binarylogic on github.
  • I am binarylogic (https://keybase.io/binarylogic) on keybase.
  • I have a public key ASCnAKZM2WXIBisJmRLt-UOsRwv8dWyzAlL7-chQ7Gcc0Qo

To claim this, I am signing this object:

@binarylogic
binarylogic / timber.rb
Created March 6, 2018 14:22
Disable all Timber integrations
config.integrations.action_controller.enabled = false
config.integrations.action_view.enabled = false
config.integrations.active_record.enabled = false
config.integrations.rack.error_event.enabled = false
config.integrations.rack.http_context.enabled = false
config.integrations.rack.http_events.enabled = false
config.integrations.rack.session_context.enabled = false
config.integrations.rack.user_context.enabled = false
@binarylogic
binarylogic / level_adjust.rb
Created November 2, 2017 15:20
Adjusting level temporarily
Rails.logger.level = :info
Rails.logger.silence(Logger::ERROR) do
Rails.logger.info("info message") # will _not_ be logged
Rails.logger.error("error mesasge") # _will_ be logged
end
Rails.logger.info("info message") # _will_ be logged
@binarylogic
binarylogic / log_entry_example.js
Created October 17, 2017 18:07
Example of using LogEntry directly with the Timber node library
const timber = require('timber')
const timber_transport = new timber.transports.HTTPS('your-api-key')
// The second argument must follow the structure defined in the Timber log event JSON schema:
// https://github.com/timberio/log-event-json-schema
log_entry = new timber.LogEntry('my log message', {context: {http: {method: 'GET', request_id: 'abcd1234'}}})
// It's important that you pass the `data` object here.
timber_transport.write(log_entry.data);
@binarylogic
binarylogic / timber_auth_example.rb
Last active September 21, 2017 00:01
Timber Auth Example
class ApplicationController < ActionController::Base
# Make sure this is called *after* you authenticate users
around_filter :set_user_context
private
def set_user_context(&block)
if !current_user.nil?
# Ensure the attributes are mapped properly here
user_context = Timber::Contexts::User.new(id: current_user.id, email: current_user.email, name: current_user.full_name)
Timber.with_context(user_context, &block)
@binarylogic
binarylogic / gist:df9db65573af9c4f69d9
Created January 29, 2015 20:03
Simple jquery example
$.ajax({
url: 'https://api.wit.ai/message',
data: {
'q': 'I need 4 tickets',
'access_token' : 'MY_WIT_TOKEN'
},
dataType: 'jsonp',
method: 'GET',
success: function(response) {
console.log("success!", response);