There's so many way to send logs to an elk... logspout, filebeat, journalbeat, etc.
But docker has a gelf log driver and logstash a gelf input. So here we are.
Here is a docker-compose to test a full elk with a container sending logs via gelf.
// Load the TCP Library | |
net = require('net'); | |
// Keep track of the chat clients | |
var clients = []; | |
// Start a TCP Server | |
net.createServer(function (socket) { | |
// Identify this client |
var Base64 = { | |
characters: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" , | |
encode: function( string ) | |
{ | |
var characters = Base64.characters; | |
var result = ''; | |
var i = 0; | |
do { |
[ | |
{rabbit, [ | |
%% snip... | |
]}, | |
{rabbitmq_shovel, [ | |
{shovels, [ | |
{'MUTHA-SHOVELER', [ | |
{sources, [ | |
{broker, "amqp://"} |
# for simple use case - doesn't take into account multiple occurrences | |
parseParams = (search = window.location.search)-> | |
d = (str)-> decodeURIComponent str.replace /\+/g, ' ' | |
query = search.substring 1 | |
regex = /(.*?)=([^\&]*)&?/g | |
params = {} | |
params[d(m[1])] = d(m[2]) while m = regex.exec query | |
params |
var crypto = require('crypto'); | |
var secret = crypto.randomBytes(24); | |
function encrypt(plaintext) { | |
var cipher = crypto.createCipher('aes-256-cbc', secret); | |
cipher.setAutoPadding(false); | |
var ciphertext = ''; | |
for (var i=0; i < plaintext.length; i+=16) { | |
ciphertext += cipher.update(plaintext.substr(i, i+16), 'utf8', 'base64'); |
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback | |
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB; | |
// Open (or create) the database | |
var open = indexedDB.open("MyDatabase", 1); | |
// Create the schema | |
open.onupgradeneeded = function() { | |
var db = open.result; | |
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"}); |
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
var UrlHelper = function (location) { | |
this.protocol = ''; | |
this.host = ''; | |
this.path = ''; | |
this.queryValues = {}; | |
this.initQueryValues = function (search) { | |
var vals = {}; | |
if (search) { |
There's so many way to send logs to an elk... logspout, filebeat, journalbeat, etc.
But docker has a gelf log driver and logstash a gelf input. So here we are.
Here is a docker-compose to test a full elk with a container sending logs via gelf.