Skip to content

Instantly share code, notes, and snippets.

View rayterrill's full-sized avatar

Ray Terrill rayterrill

View GitHub Profile
param (
[Parameter(Mandatory=$true)][string]$OU,
[Parameter(Mandatory=$true)][string]$user
)
Import-Module ActiveDirectory
Set-Location AD:
#declare an array to hold results
$results = @()

How to Track Down Graylog Indexer Failures

"failed to parse" Messages

  1. Identify the fields that are failing to parse (for example, 'deviceCustomDate1' in the below message):
{"type":"mapper_parsing_exception","reason":"failed to parse [deviceCustomDate1]","caused_by":{"type":"illegal_argument_exception","reason":"Invalid format: \"50840-10-23\" is malformed at \"0-10-23\""}}
  1. Identify the messages that have the fields that are failing to parse. You can use Graylog's search functionality to find messages with the field names that are failing to parse:

Keybase proof

I hereby claim:

  • I am rayterrill on github.
  • I am rayterrill (https://keybase.io/rayterrill) on keybase.
  • I have a public key ASBB5N6px85iRe9-smHf-6A00-3IEpeuvTjcaCKzJZIH9Ao

To claim this, I am signing this object:

@rayterrill
rayterrill / Node.md
Last active June 10, 2018 19:12
Infrastructure as Code Notes

Terraform Hygiene

  1. Validate our code compiles
terraform validate
  1. Format our code correctly
terraform fmt
@rayterrill
rayterrill / Backup.ps1
Created May 25, 2018 23:50
Backup video files to S3
Write-S3Object -BucketName 107ist-video -Folder .\clip -KeyPrefix 'TimbersArmy/5-22-2018_T2_vs_FCStPauli'
@rayterrill
rayterrill / default.rb
Created May 22, 2018 15:18
Chef code to use AWS Secrets Manager in a Chef Recipe
# Chef code to use AWS Secrets Manager in a Chef Recipe
include_recipe "chef-vault"
vault = chef_vault_item(:chefsecrets, "awschefsecretsmanager")
aws_access_key = vault["access_key_id"]
aws_secret_key = vault["secret_access_key"]
require 'aws-sdk'
require 'json'
@rayterrill
rayterrill / GetGithubReposViaAPI.ps1
Created April 27, 2018 04:18
GetGithubReposViaAPI.ps1
$AuthString = '{0}:{1}' -f 'USERNAME','PASSWORD'
$AuthBytes = [System.Text.Encoding]::Ascii.GetBytes($AuthString)
$global:BasicCreds = [Convert]::ToBase64String($AuthBytes)
$content = invoke-webrequest https://api.github.com/orgs/PortofPortland/repos?type=All -Headers @{"Authorization"="Basic $BasicCreds"}
$content.Content | ConvertFrom-JSON
@rayterrill
rayterrill / gist:90f066dd0cb732cdcee646578b47e83d
Created April 21, 2018 02:50
Calling hashicorp vault from Chef
remote_file '/tmp/database.json' do
backup false
source 'https://vault.hashicorp.rocks/v1/postgresql/creds/readonly'
headers({
'X-Vault-Token' => ENV['VAULT_TOKEN'],
})
mode '0644'
action :create
notifies :create, 'ruby_block[write_config]', :immediately
not_if { File.exist?('/tmp/database.json') }
// Description:
// Allows Hubot to create channels for incidents on the fly
//
// Configuration:
// None
//
// Commands:
// hubot create incident <name> - automagically creates an incident channel + invites all users
const { WebClient } = require('@slack/client');