diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index c8cf5bfa798..f19456f5143 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -160,6 +160,7 @@ ./services/hardware/udisks2.nix ./services/hardware/upower.nix ./services/hardware/thermald.nix + ./services/logging/fluentd.nix ./services/logging/klogd.nix ./services/logging/logcheck.nix ./services/logging/logrotate.nix diff --git a/nixos/modules/services/logging/fluentd.nix b/nixos/modules/services/logging/fluentd.nix new file mode 100644 index 00000000000..61eeec504e0 --- /dev/null +++ b/nixos/modules/services/logging/fluentd.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.fluentd; +in { + ###### interface + + options = { + + services.fluentd = { + enable = mkOption { + type = types.bool; + default = false; + description = "Whether to enable fluentd."; + }; + + config = mkOption { + type = types.lines; + default = ""; + description = "Fluentd config."; + }; + }; + }; + + + ###### implementation + + config = mkIf cfg.enable { + systemd.services.fluentd = with pkgs; { + description = "Fluentd Daemon"; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + ExecStart = "${pkgs.fluentd}/bin/fluentd -c ${pkgs.writeText "fluentd.conf" cfg.config}"; + }; + }; + }; +} diff --git a/pkgs/tools/misc/fluentd/Gemfile b/pkgs/tools/misc/fluentd/Gemfile new file mode 100644 index 00000000000..41c5bde1acc --- /dev/null +++ b/pkgs/tools/misc/fluentd/Gemfile @@ -0,0 +1,4 @@ +source "https://rubygems.org" + +gem 'fluentd' +gem 'fluent-plugin-elasticsearch' diff --git a/pkgs/tools/misc/fluentd/Gemfile.lock b/pkgs/tools/misc/fluentd/Gemfile.lock new file mode 100644 index 00000000000..ba4cc4bb4a8 --- /dev/null +++ b/pkgs/tools/misc/fluentd/Gemfile.lock @@ -0,0 +1,49 @@ +GEM + remote: https://rubygems.org/ + specs: + cool.io (1.3.0) + elasticsearch (1.0.8) + elasticsearch-api (= 1.0.7) + elasticsearch-transport (= 1.0.7) + elasticsearch-api (1.0.7) + multi_json + elasticsearch-transport (1.0.7) + faraday + multi_json + faraday (0.9.1) + multipart-post (>= 1.2, < 3) + fluent-plugin-elasticsearch (0.7.0) + elasticsearch + fluentd (>= 0.10.43) + patron (~> 0) + fluentd (0.12.6) + cool.io (>= 1.2.2, < 2.0.0) + http_parser.rb (>= 0.5.1, < 0.7.0) + json (>= 1.4.3) + msgpack (>= 0.5.11, < 0.6.0) + sigdump (~> 0.2.2) + string-scrub (>= 0.0.3) + tzinfo (>= 1.0.0) + tzinfo-data (>= 1.0.0) + yajl-ruby (~> 1.0) + http_parser.rb (0.6.0) + json (1.8.2) + msgpack (0.5.11) + multi_json (1.11.0) + multipart-post (2.0.0) + patron (0.4.20) + sigdump (0.2.2) + string-scrub (0.0.5) + thread_safe (0.3.5) + tzinfo (1.2.2) + thread_safe (~> 0.1) + tzinfo-data (1.2015.1) + tzinfo (>= 1.0.0) + yajl-ruby (1.2.1) + +PLATFORMS + ruby + +DEPENDENCIES + fluent-plugin-elasticsearch + fluentd diff --git a/pkgs/tools/misc/fluentd/default.nix b/pkgs/tools/misc/fluentd/default.nix new file mode 100644 index 00000000000..b659dafddeb --- /dev/null +++ b/pkgs/tools/misc/fluentd/default.nix @@ -0,0 +1,20 @@ +{ stdenv, lib, bundlerEnv, ruby, curl }: + +bundlerEnv { + name = "fluentd-0.12.6"; + + inherit ruby; + gemfile = ./Gemfile; + lockfile = ./Gemfile.lock; + gemset = ./gemset.nix; + + buildInputs = [ curl ]; + + meta = with lib; { + description = "Fluentd data collector."; + homepage = http://www.fluentd.org/; + license = with licenses; asl20; + maintainers = with maintainers; [ offline ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/tools/misc/fluentd/gemset.nix b/pkgs/tools/misc/fluentd/gemset.nix new file mode 100644 index 00000000000..4d0072c6afe --- /dev/null +++ b/pkgs/tools/misc/fluentd/gemset.nix @@ -0,0 +1,171 @@ +{ + "cool.io" = { + version = "1.3.0"; + source = { + type = "gem"; + sha256 = "1s3x0a32gbr6sg4lb0yk5irh48z4260my6g5ssifyl54rh4b6lzh"; + }; + }; + "elasticsearch" = { + version = "1.0.8"; + source = { + type = "gem"; + sha256 = "0kfiza9p98gchqgd0a64ryw77wgy42b7hhy89ba1s2jy2kcm3ahl"; + }; + dependencies = [ + "elasticsearch-api" + "elasticsearch-transport" + ]; + }; + "elasticsearch-api" = { + version = "1.0.7"; + source = { + type = "gem"; + sha256 = "0fb7pmzhfl48zxkbx3ayc61x1gv3qvvs4xcp4yf1rxflz1iw6ck9"; + }; + dependencies = [ + "multi_json" + ]; + }; + "elasticsearch-transport" = { + version = "1.0.7"; + source = { + type = "gem"; + sha256 = "0p5yzbvgpw84asfj8ifbqckw6qbssc6xrw086qfh58kxpfnin0zc"; + }; + dependencies = [ + "faraday" + "multi_json" + ]; + }; + "faraday" = { + version = "0.9.1"; + source = { + type = "gem"; + sha256 = "1h33znnfzxpscgpq28i9fcqijd61h61zgs3gabpdgqfa1043axsn"; + }; + dependencies = [ + "multipart-post" + ]; + }; + "fluent-plugin-elasticsearch" = { + version = "0.7.0"; + source = { + type = "gem"; + sha256 = "1jav4lqf9j3w014ksgl3zr05kg62lkc58xnhjjriqp3c1412vwpy"; + }; + dependencies = [ + "elasticsearch" + "fluentd" + "patron" + ]; + }; + "fluentd" = { + version = "0.12.6"; + source = { + type = "gem"; + sha256 = "04lrr133ci6m3j85cj2rhhjkw3b1r12fxcymk943lsdlrip0brr1"; + }; + dependencies = [ + "cool.io" + "http_parser.rb" + "json" + "msgpack" + "sigdump" + "string-scrub" + "tzinfo" + "tzinfo-data" + "yajl-ruby" + ]; + }; + "http_parser.rb" = { + version = "0.6.0"; + source = { + type = "gem"; + sha256 = "15nidriy0v5yqfjsgsra51wmknxci2n2grliz78sf9pga3n0l7gi"; + }; + }; + "json" = { + version = "1.8.2"; + source = { + type = "gem"; + sha256 = "0zzvv25vjikavd3b1bp6lvbgj23vv9jvmnl4vpim8pv30z8p6vr5"; + }; + }; + "msgpack" = { + version = "0.5.11"; + source = { + type = "gem"; + sha256 = "1jmi0i3j8xfvidx6ivbcbdwpyf54r0d7dc4rrq1jbvhd1ffvr79w"; + }; + }; + "multi_json" = { + version = "1.11.0"; + source = { + type = "gem"; + sha256 = "1mg3hp17ch8bkf3ndj40s50yjs0vrqbfh3aq5r02jkpjkh23wgxl"; + }; + }; + "multipart-post" = { + version = "2.0.0"; + source = { + type = "gem"; + sha256 = "09k0b3cybqilk1gwrwwain95rdypixb2q9w65gd44gfzsd84xi1x"; + }; + }; + "patron" = { + version = "0.4.20"; + source = { + type = "gem"; + sha256 = "0wdgjazzyllnajkzgdh55q60mlczq8h5jhwpzisrj2i8izrq45zb"; + }; + }; + "sigdump" = { + version = "0.2.2"; + source = { + type = "gem"; + sha256 = "1h4d4vfg1g3wbbmqahmk7khzhswk5mjv4hwbs7bhmp808h8mz973"; + }; + }; + "string-scrub" = { + version = "0.0.5"; + source = { + type = "gem"; + sha256 = "0fy4qby2az268qzmf00mb3p0hiqgshz9g6kvgl5vg76y90hl178g"; + }; + }; + "thread_safe" = { + version = "0.3.5"; + source = { + type = "gem"; + sha256 = "1hq46wqsyylx5afkp6jmcihdpv4ynzzq9ygb6z2pb1cbz5js0gcr"; + }; + }; + "tzinfo" = { + version = "1.2.2"; + source = { + type = "gem"; + sha256 = "1c01p3kg6xvy1cgjnzdfq45fggbwish8krd0h864jvbpybyx7cgx"; + }; + dependencies = [ + "thread_safe" + ]; + }; + "tzinfo-data" = { + version = "1.2015.1"; + source = { + type = "gem"; + sha256 = "1x6fa8ayd2kal397d5gdsdg0fjqynfqv1n9n0q702mq839dw593h"; + }; + dependencies = [ + "tzinfo" + ]; + }; + "yajl-ruby" = { + version = "1.2.1"; + source = { + type = "gem"; + sha256 = "0zvvb7i1bl98k3zkdrnx9vasq0rp2cyy5n7p9804dqs4fz9xh9vf"; + }; + }; +} \ No newline at end of file diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b4f73137298..7707eb48d4b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1309,6 +1309,8 @@ let flpsed = callPackage ../applications/editors/flpsed { }; + fluentd = callPackage ../tools/misc/fluentd { }; + flvstreamer = callPackage ../tools/networking/flvstreamer { }; libbsd = callPackage ../development/libraries/libbsd { };