Skip to content

Instantly share code, notes, and snippets.

GaryRogers /
Last active Mar 2, 2022
Getting Composer and PHPUnit to autoload namespaces

Getting Composer and PHPUnit to autoload namespaces.



Project Structure

GaryRogers / logstash.conf
Created May 16, 2014
Monolog Logstash Config example
View logstash.conf
input {
stdin { codec => "plain" }
filter {
# Pulls out fields from monolog text log. (Note, we don't send extra to our monolog)
grok {
match => [ "message", "%{MONOLOG} %{GREEDYDATA:mymessage}"]
GaryRogers /
Last active Jun 27, 2021
RSyslog Forwarding Setup

RSyslog Forwarding Setup


I'm looking to centralize logging for our dev team into Elasticsearch via Logstash. The wrinkle is that we aren't a Java shop, so installing java on our hosts just to ship logs back to a central Logstash indexer is something we'd like to avoid. So, I'm approaching things as a chance to understand RSyslog and its capabilities as a log shipper.


Set up TCP listening on the log index host

Uncomment the following lines in /etc/rsyslog.conf. This will enable the rsyslog daemon to listen for incoming requests on TCP port 514. We're using TCP here so that we can have some confidence that the messages from the agent hosts reach the indexer. (More on this below)

GaryRogers / sysinfo.js
Created Feb 25, 2016
sysinfo.js, get system information in json format.
View sysinfo.js
* Get System Information in json format. Gets Run Queue, Memory and Swap Info.
var os = require('os');
var fs = require('fs');
var sysinfo = {};
sysinfo.hostname = os.hostname();
GaryRogers / createPhar.php
Last active Mar 28, 2020
Create a Phar archive for PHP
View createPhar.php
# Create an executable phar
# Name of our archive.
$phar = new Phar("myscript.phar");
# Have to do buffering to make things executable.
# See
GaryRogers /
Last active Feb 8, 2020
Provisioning Vagrant CentOS hosts
import dpath.util
def dpath_null(data: dict, path: str, default_return = None):
'''function to trap any KeyErrors for dpath and return an acceptable 'null' value when dpath can't find a path
Example 1
# Will return None if /some/path/to/an/attribute can not be found
var = dpath_null(my_dictionary, '/some/path/to/an/attribute')

Replaying logs to logstash

  • Copy comprssed log files to a work area.
  • Uncompress them, remove date part of file name.
  • Copy /etc/logstash/conf.d/*.conf to a work location.
  • Modify conf files to change output to stdout { codev => "rubydebug" }
  • You want to do this to make sure things are working before you push logs into ElasticSearch.
  • Modify conf files to change path in the input/file section
GaryRogers /
Last active Apr 29, 2019
TestComplete Jenkins Integration Notes

TestComplete Jenkins Integration Notes

Agent Node Setup

  • Triple check your GPOs.
  • Run Resultant Set of GPOs to make sure some up-stream GPO isn't doing something you don't expect.
  • Shadow the RDP session to see what TestExecute is doing.
    • If you don't see TestExecute start in a session, double check your username variable in the pipeline.
  • Run Agent Node as a windows service.
  • Let service interact with the desktop.
GaryRogers / gist:ad17907ddad83769b1ac
Last active Aug 22, 2018
CentOS/Elasticsearch Dockerfile
View gist:ad17907ddad83769b1ac
# Docker file to create a CentOS Elasticsearch host.
FROM centos:centos6
MAINTAINER Gary Rogers <>
# Install things as roo
USER root
yum update -y --quiet && \
yum install -y --quiet wget && \