Skip to content

Instantly share code, notes, and snippets.

@wardbekker
wardbekker / fluent-bit.conf
Created April 14, 2020 08:44
Fluent-Bit example configuration for Loki
[INPUT]
Name tail
Path /var/log/*.log
Path_Key filename
[Output]
Name loki
Match *
Url http://localhost:3100/loki/api/v1/push
BatchWait 1
@wardbekker
wardbekker / gist:964146
Created May 10, 2011 09:16
Naive parallel import of Compressed MYSQL dump file
# Split MYSQL dump file
zcat dump.sql.gz | awk '/DROP TABLE IF EXISTS/{n++}{print >"out" n ".sql" }'
# Parallel import using GNU Parallel http://www.gnu.org/software/parallel/
ls -rS *.sql | parallel --joblog joblog.txt mysql -uXXX -pYYY db_name "<"
@wardbekker
wardbekker / awesome_web_app_dashboard.json
Last active October 19, 2022 11:16
Demo dashboard for loki+prom example web app dashboard
{
"dashboard" : {
"annotations": {
"list": [
{
"datasource": "Loki",
"enable": true,
"expr": "{service=~\"[[service]]\"} Error",
"hide": false,
"iconColor": "rgba(255, 96, 96, 1)",
loki:
config:
auth_enabled: false
ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tiller
@wardbekker
wardbekker / fluent.conf
Created April 14, 2020 08:45
FluentD example for output to Loki
<source>
@type tail
format none
path /var/log/*.log
pos_file positions.pos
tag varlog.*
path_key filename
</source>
<match varlog.**>
@wardbekker
wardbekker / dashboard.json
Created June 11, 2020 19:34
Loki Nginx Web Analytics Dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
-module(user_default).
-author('serge@hq.idt.net').
%% Compile this file and use this line in your ~/.erlang file (with
%% correct path, of course!) to where the user_default.beam file is stored.
%%
%% code:load_abs("/home/fritchie/erlang/user_default").
-export([help/0,dbgtc/1, dbgon/1, dbgon/2,
dbgadd/1, dbgadd/2, dbgdel/1, dbgdel/2, dbgoff/0,
@wardbekker
wardbekker / spdy_erlang.md
Created October 2, 2012 07:32
Enable SPDY for your Erlang website.
@wardbekker
wardbekker / config.yaml
Created April 14, 2020 08:48
Promtail example configuration for Loki
scrape_configs:
- job_name: system
pipeline_stages:
static_configs:
- targets:
- localhost
labels:
job: varlogs
host: ward_workstation
agent: promtail