Skip to content

Instantly share code, notes, and snippets.

View meetupwayne's full-sized avatar

Wayne Folkes meetupwayne

View GitHub Profile
import boto3
import json
import urllib, urllib2
import os
from datetime import datetime
from dateutil import tz
import time
ecs = boto3.client('ecs')
sns = boto3.client('sns')
@meetupwayne
meetupwayne / es-splunk.js
Created April 20, 2017 20:59
Sends logs to Elasticsearch and Splunk
// v1.1.2
var https = require('https');
var zlib = require('zlib');
var crypto = require('crypto');
var endpoint = process.env.Custom;
const loggerConfig = {
url: process.env.SPLUNK_HEC_URL || 'https://<HOST>:<PORT>/services/collector',
token: process.env.SPLUNK_HEC_TOKEN || '<TOKEN>',
fname = raw_input("Enter file name: ")
if len(fname) < 1 : fname = "mbox-short.txt"
fh = open(fname)
count = 0
for line in fh:
if line.startswith('From') and not line.startswith('From:'):
print line.split()[1]
count+= 1
print ("Enter file name: ")
fname = gets.strip()
fname = "mbox-short.txt" if (fname.length < 1)
fh = open(fname)
count = 0
fh.readlines.each do |line|
if line.start_with?('From') and not line.start_with?('From:') then
puts line.split()[1]