Skip to content

Instantly share code, notes, and snippets.

Avatar

Gary Rogers GaryRogers

View GitHub Profile
@GaryRogers
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
GaryRogers / RSyslogSetup.md
Last active Sep 29, 2020
RSyslog Forwarding Setup
View RSyslogSetup.md

RSyslog Forwarding Setup

Overview

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.

Procedure

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
GaryRogers / ComposerPHPUnit.md
Last active Jul 24, 2020
Getting Composer and PHPUnit to autoload namespaces
View ComposerPHPUnit.md

Getting Composer and PHPUnit to autoload namespaces.

Overview

Details

Project Structure

ProjectRoot
 src
@GaryRogers
GaryRogers / createPhar.php
Last active Mar 28, 2020
Create a Phar archive for PHP
View createPhar.php
<?php
# Create an executable phar
# Name of our archive.
$phar = new Phar("myscript.phar");
# Have to do buffering to make things executable.
# See http://stackoverflow.com/questions/11082337/how-to-make-an-executable-phar
$phar->startBuffering();
@GaryRogers
GaryRogers / VagrantCentOS.md
Last active Feb 8, 2020
Provisioning Vagrant CentOS hosts
View VagrantCentOS.md
View dpath_null.py
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')
View LogstashReplay.md

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
GaryRogers / tc_jenkins_integration_notes.md
Last active Apr 29, 2019
TestComplete Jenkins Integration Notes
View tc_jenkins_integration_notes.md

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
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 <gary-rogers@uiowa.edu>
# Install things as roo
USER root
RUN \
yum update -y --quiet && \
yum install -y --quiet wget && \
@GaryRogers
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}"]
}
You can’t perform that action at this time.