Skip to content

Instantly share code, notes, and snippets.

View megastef's full-sized avatar
🏠
Working from home

Megastef megastef

🏠
Working from home
  • Twitter: @seti321
  • Germany
View GitHub Profile
@megastef
megastef / patterns.yml
Last active May 9, 2017 11:29
a multiline pattern for SDA / logagent
patterns:
- # your app name
blockStart: !!js/regexp ^\d{4}-\d{2}-\d{2}_\d{2}:\d{2}:\d{2}
sourceName: !!js/regexp /YOUR_IMAGE_NAME_HERE/i
match:
- type: YOUR_IMAGE_OR_APP_NAME
regex: !!js/regexp /^(\d{4}-\d{2}-\d{2}_\d{2}:\d{2}:\d{2})\s+(\S+)\s+\[(.+?)\]\s{0,4}\[(.+?)\]\s-\s([\S|\s]+)/
dateFormat: YYYY-MM-DD_HH:mm:ss
fields:
- ts
@megastef
megastef / patterns.yml
Created May 5, 2017 09:45
Example process JSON from journald before shipping with Sematext Docker Agent or Logagent
json:
enabled: true
removeFields:
- __CURSOR
- __MONOTONIC_TIMESTAMP
- _TRANSPORT
- JOURNAL_NAME
- JOURNAL_PATH
- CURRENT_USE
- CURRENT_USE_PRETTY
{
"/": {
"name": "/",
"subcontainers": [
{
"name": "/docker"
},
{
"name": "/init.scope"
},
@megastef
megastef / log4j-pattern.yaml
Last active March 21, 2017 12:33
log4j logagent pattern
originalLine: false
patterns:
- # log4j logs, please replace sourceName with a pattern for your image or container name
sourceName: !!js/regexp /.*/i
blockStart: !!js/regexp /^\d+\/\d+\/\d+\s/
match:
- regex: !!js/regexp /(\d+\/\d+\/\d+\s\d+\:\d+\:\d+)\s\S+\s\S+\s\[(\S+)\]\s(\S+)\s+(\S+)\s+-\s+([\S\|\s]+)/i
type: yourAppNameLog4j
fields:
@megastef
megastef / export.json
Created February 15, 2017 14:53
Kibana Docker / GeoIP
[
{
"_id": "default",
"_type": "dashboard",
"_source": {
"title": "default",
"hits": 0,
"description": "",
"panelsJSON": "[{\"col\":1,\"id\":\"Map\",\"panelIndex\":1,\"row\":1,\"size_x\":5,\"size_y\":5,\"type\":\"visualization\"},{\"col\":1,\"columns\":[\"host\",\"severity\",\"message\",\"compose_project\",\"compose_container_number\",\"compose_service\",\"docker_host\",\"image_name\",\"swarm_id\"],\"id\":\"Logs\",\"panelIndex\":2,\"row\":6,\"size_x\":7,\"size_y\":5,\"sort\":[\"@timestamp\",\"desc\"],\"type\":\"search\"},{\"col\":6,\"id\":\"Containers-per-host-and-image-type\",\"panelIndex\":3,\"row\":1,\"size_x\":4,\"size_y\":5,\"type\":\"visualization\"},{\"col\":10,\"id\":\"Docker-Compose-Image-slash-Service\",\"panelIndex\":4,\"row\":1,\"size_x\":3,\"size_y\":5,\"type\":\"visualization\"},{\"id\":\"Containers-per-host\",\"type\":\"visualization\",\"panelIndex\":5,\"size_x\":3,\"size_y\":5,\"col\":10,\"row\":6}]",
"optionsJSON": "{\"darkTheme\":false}",
@megastef
megastef / pattern.yml
Last active December 23, 2016 11:23
lambda-multiline-test
originalLine: true
geoIP: true
maxmindDbDir: /tmp/
json:
enabled: false
patterns:
- # multi line test
@megastef
megastef / templates.json
Last active November 13, 2016 19:45
portainer template
[
{
"title": "Sematext Agent",
"description": "Collect logs, metrics and docker events",
"logo": "https://sematext.com/wp-content/uploads/2016/08/octi.png",
"image": "sematext/sematext-agent-docker:latest",
"name": "sematext-agent",
"env": [
{
"name": "LOGSENE_TOKEN",
@megastef
megastef / patterns.yml
Last active October 18, 2016 11:28 — forked from Leen15/patterns.yml
Patterns for sematext agent
patterns:
- sourceName: !!js/regexp /docker-nginx-loadbalancer/
match:
- type: nginxbalancer
regex: !!js/regexp /^(\[(.+?)\]\s-\sclient_ip=(.+?)\slb=(.+?)\scontainer=(.+?)\sresponse_status=(.+?)\spath="(.+?)"\sresponse=(.+?)\scontainer_status=(.+?)\stotal_time=(.+?)\sbytes=(.+?)\suser_agent="(.+?)"\shost=(.+?)\sbody=(.+)$)/i
fields:
- message
- ts
- client_ip:string
- lb:string
@megastef
megastef / docker-compose-in-process.yml
Last active January 20, 2017 10:40
tomcat monitoring on docker
# in-process monitor for Tomcat, needs less resources and no network setup
version: '2'
services:
spm-client:
image: sematext/spm-client
container_name: spm-client-tc
hostname: spm-client-tc
environment:
# please set env var SPM_TOKEN before you run docker-compose
@megastef
megastef / httpd.conf
Created June 8, 2016 08:47
default httpd.conf with stats enabled
ServerRoot "/usr/local/apache2"
Listen 80
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so