Skip to content

Instantly share code, notes, and snippets.

View VerosK's full-sized avatar
🚌
On the road.

Věroš Kaplan VerosK

🚌
On the road.
View GitHub Profile
@shreyaskarnik
shreyaskarnik / Instructions.md
Last active March 24, 2023 15:35
Route Docker Logs to ELK Stack
  • With Docker 1.8.0 shipped new log-driver for GELF via UDP, this means that the logs from Docker Container(s) can be shipped directly to the ELK stack for further analysis.
  • This tutorial will illustrate how to use the GELF log-driver with Docker engine.
  • Step 1: Setup ELK Stack:
    • docker run -d --name es elasticsearch
    • docker run -d --name logstash --link es:elasticsearch logstash -v /tmp/logstash.conf:/config-dir/logstash.conf logstash logstash -f /config-dir/logstash.conf
    • Note the config for Logstash can be found at this link
    • docker run --link es:elasticsearch -d kibana
  • Once the ELK stack is up now let's fire up our nginx container which ships its logs to ELK stack.
  • LOGSTASH_ADDRESS=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' logstash)
  • `docker run -d --net=host --log-driver=gelf --log-opt gelf-address=u
# -*- coding: utf-8 -*-
"""
Based on:
https://gist.github.com/meeuw/c3bc9dd07945c87c89e6#file-findfiles-py
https://bitbucket.org/nosklo/pysmbclient/wiki/Home
"""
import os
import pexpect
import re
@VerosK
VerosK / parse-json.logstash.conf
Created May 28, 2015 11:19
Logstash - parse JSON
filter {
# if it looks like json, tag it
if [type] == 'syslog' and [message] =~ '{.*}' {
json {
source => 'message'
target => 'json_data'
add_tag => ['has_json']
}
}
@halberom
halberom / 00_description
Last active April 14, 2022 19:23
ansible - example of using filters to change each item in a list
The problem:
I wanted to use the jinja 'map' filter to modify each item in a string, in this simple
example, adding '.conf' to each item.
The 'format' filter in jinja takes arguments (value, *args, **kwargs). Unfortunately,
it uses 'value' as the pattern. When called inside map 'value' is the current item in
the list, or in other words *args as far as format is concerned. So it's the wrong way
around.
@imranity
imranity / groovy-create-user.md
Last active April 10, 2024 17:29
Jenkins Groovy enable security and create a user in groovy script

This is a snippet that will create a new user in jenkins and if security has been disabled , it will enable it :)

import jenkins.model.*
import hudson.security.*

def instance = Jenkins.getInstance()

def hudsonRealm = new HudsonPrivateSecurityRealm(false)
hudsonRealm.createAccount("MyUSERNAME","MyPASSWORD")
instance.setSecurityRealm(hudsonRealm)
@lazyfrosch
lazyfrosch / gist:51299c416656fe76209f
Created January 5, 2015 13:40
Icinga 2 Command Endpoint example
template Host "generic-agent" {
import "generic-host"
object Endpoint __name {
host = "$host.address$"
}
object Zone __name {
parent = "master"
endpoints = [ __name ]
@abrahamrhoffman
abrahamrhoffman / centos7ksiso.md
Last active March 11, 2022 22:39
CentOS 7 Kickstart File & How to build an (auto install) ISO

CentOS 7 Kickstart File - HOWTO Build ISO

There is so much documentation online from RedHat and CentOS about this topic - it's sad that I am writing this. But the real state of documentation on this topic (CentOS 7 + KS + ISO = Bootable DVD) is almost non-existent.

I found this: http://smorgasbork.com/component/content/article/35-linux/151-building-a-custom-centos-7-kickstart-disc-part-1

Which I greatly appreciate and +1, but the documentation is half-baked and there are numerous errors.

Finally... FINALLY! After four days of banging my head, I got this to work. Hopefully someone else will be able to do this in a few hours, instead of blowing their weekend like me. :(

@thomasmb
thomasmb / mysql_pwd_reset.sh
Created August 12, 2014 20:55
A shell script for resetting the root MySQL password
# Please confirm that you want to reset the MySQL passwords
CONFIRM="n"
echo -n "Please confirm MySQL password reset. Continue? (y/N): "
read -n 1 CONFIRM_INPUT
if [ -n "$CONFIRM_INPUT" ]; then
CONFIRM=$CONFIRM_INPUT
fi
echo
@nrvale0
nrvale0 / gist:9939664
Last active October 15, 2015 19:25
Example of Puppet Collector to avoid using Stages for prep of Yum repo
# Example of using Collector to avoid having to do
# clever things with Puppet Stages.
yumrepo { 'epel':
...
}
# For all Package resources in the catalog, append
# the EPEL repo to the require metaparameter thus
# ensuring that the EPEL yumrepo has been configured
@ubergarm
ubergarm / do-docker-0.90.md
Created March 21, 2014 20:21
DigitalOcean Docker 0.90 w/ cgroups and memory limits working.

DigitalOcean Latest Docker

Spin up a new droplet using stock Ubuntu 12.04.3 LTS

Rough Guide that would make a nice Ansible role:

# update kernel saucy 3.11.0-18-generic
$ apt-get update

$ apt-get purge linux-image-*