Skip to content

Instantly share code, notes, and snippets.

View gcleaves's full-sized avatar

Geoffrey Cleaves gcleaves

  • Barcelona, Spain
View GitHub Profile
@omaryoussef
omaryoussef / Create_Laravel_Pipeline.txt
Last active May 20, 2024 10:53
Creates a Filebeat pipeline to ingest Laravel Monolog/log lines.
PUT _ingest/pipeline/laravel
{
"description": "Parses Laravel log files.",
"processors": [
{
"rename": {
"field": "message",
"target_field": "event.original"
}
},
@mtrbean
mtrbean / mysql_date_trunc
Last active February 2, 2021 21:18
MySQL date_trunc equivalent
DATE_TRUNC('week', now()) === STR_TO_DATE(CONCAT(YEARWEEK(now(), 2), ' Sunday'), '%X%V %W')
DATE_TRUNC('month', now()) === DATE_FORMAT(now(), '%Y-%m-01')
@phillro
phillro / gist:1147306
Created August 15, 2011 17:50
Elastica with an authenticated search
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/Elastica/lib'));
function elasticsearch_autoload($class) {
$file = str_replace('_', '/', $class) . '.php';
require_once $file;
}
spl_autoload_register('elasticsearch_autoload');
defined('BASE_PATH') || define('BASE_PATH', realpath(dirname(__FILE__)));