Skip to content

Instantly share code, notes, and snippets.

View faxm0dem's full-sized avatar
⌨️
Typing…

Fabien Wernli faxm0dem

⌨️
Typing…
View GitHub Profile
@faxm0dem
faxm0dem / syslog-ng.conf
Created November 28, 2015 21:24
syslog-ng file destination
template t_logformat {
template("$ISODATE $HOST <$FACILITY.$PRIORITY> $LEGACY_MSGHDR$MSG\n");
template_escape(no);
};
destination d_remote_by_host {
file("/var/syslog-ng/remote/$YEAR/$MONTH/$DAY/by-host/${HOST}" template(t_logformat));
};
@faxm0dem
faxm0dem / syslog-ng.conf
Created November 28, 2015 21:35
syslog-ng config no named blocks
log {
source {
file("/var/log/messages");
};
destination {
syslog("localhost");
};
};
@faxm0dem
faxm0dem / java_foo.rb
Created November 30, 2015 13:20
puppet rspec fact multiple resolutions
Facter.add(:java_foo) do
has_weight 100
setcode do
'bar'
end
end
Facter.add(:java_foo) do
has_weight 200
setcode do
@faxm0dem
faxm0dem / syslog-ng.conf
Created December 16, 2015 13:45
syslog-ng create-dirs
@version: 3.5.6
log {
source {
file(
"/dev/stdin",
flags(no-parse),
);
};
destination {
@faxm0dem
faxm0dem / getaddress.rb
Last active December 17, 2015 15:15
puppet function to lookup address
require 'resolv'
module Puppet::Parser::Functions
newfunction(:getaddress, :type => :rvalue, :doc => <<-EOS
Takes string and tries to resolve IP
EOS
) do |arguments|
if (arguments.size != 1) then
raise(Puppet::ParseError, "getaddress(): Wrong number of arguments " +
@faxm0dem
faxm0dem / syslog-ng-znc.conf
Created August 16, 2016 13:30
syslog-ng ZNC source
source s_irc {
channel {
source {
file(
"/etc/znc/moddata/log/in2p3-log/freenode/#ecole_in2p3/%{::manifests::ecole2015::current_date}.log"
log-fetch-limit(1)
flags(no-parse)
program-override(irc)
);
};
@faxm0dem
faxm0dem / run.sh
Created September 27, 2016 14:53
syslog-ng debugging config
☠ syslog-ng -f syslog-ng-debug.conf -R /tmp/R -p /tmp/p -c /tmp/c -Fdv
@faxm0dem
faxm0dem / syslog-ng-debug.conf
Last active February 8, 2017 14:42
syslog-ng -R /tmp/R -p /tmp/p -c /tmp/c -f /etc/syslog-ng/syslog-ng-debug.conf -Fdv
@version: 3.5
source s_tdin {
file("/dev/stdin" flags(no-parse));
};
destination d_stdout {
file("/dev/stdout");
};
@faxm0dem
faxm0dem / syslog-ng-flags-final.conf
Last active February 8, 2017 14:02
syslog-ng flags final
@version: 3.5
source s_tdin {
file("/dev/stdin" flags(no-parse));
};
destination d_one {
file("/tmp/one");
};
@faxm0dem
faxm0dem / syslog-ng-receiver.conf
Last active February 9, 2017 09:33
syslog-ng SDATA RFC5424
source s_remote_udp {
network(
transport(udp),
port(514),
flags(syslog-protocol)
);
};
filter f_dell {
match(