Browse Source

add elastic/logging

pull/1/head
Daniel Poelzleithner 6 months ago
parent
commit
d4a933f473

+ 71
- 0
hosts/containers/elastic/configuration.nix View File

@@ -0,0 +1,71 @@
1
+# Edit this configuration file to define what should be installed on
2
+# your system.  Help is available in the configuration.nix(5) man page
3
+# and in the NixOS manual (accessible by running ‘nixos-help’).
4
+
5
+{ config, pkgs, lib, ... }:
6
+
7
+{
8
+  imports =
9
+    [ ../../../lib/lxc-container.nix
10
+    ../../../lib/shared.nix
11
+    ../../../lib/admins.nix
12
+  ];
13
+
14
+  environment.systemPackages = with pkgs; [
15
+    vim
16
+  ];
17
+
18
+  networking = {
19
+    hostName = "elastic1";
20
+  };
21
+
22
+  nixpkgs.config.allowUnfree = true; 
23
+
24
+  services.openssh = {
25
+    enable = true;
26
+    permitRootLogin = "yes";
27
+  };
28
+
29
+  services.elasticsearch = {
30
+    enable = true;
31
+    cluster_name = "zentralwerk";
32
+    dataDir = "/srv/elasticsearch";
33
+    listenAddress = "0.0.0.0";
34
+
35
+  };
36
+
37
+  # does not work, needs to be set on hv (done through ansible)
38
+  boot.kernel.sysctl = {
39
+    "vm.max_map_count"="262144";
40
+  };
41
+
42
+  services.elasticsearch-curator = {
43
+    enable = true;
44
+    actionYAML = ''
45
+  ---
46
+  actions:
47
+    1:
48
+      action: delete_indices
49
+      description: >-
50
+        Delete indices older than 45 days (based on index name), for logstash-
51
+        prefixed indices. Ignore the error if the filter does not result in an
52
+        actionable list of indices (ignore_empty_list) and exit cleanly.
53
+      options:
54
+        ignore_empty_list: True
55
+        disable_action: False
56
+      filters:
57
+      - filtertype: pattern
58
+        kind: prefix
59
+        value: logstash-
60
+      - filtertype: age
61
+        source: name
62
+        direction: older
63
+        timestring: '%Y.%m.%d'
64
+        unit: days
65
+        unit_count: 45
66
+    '';
67
+  };
68
+
69
+  system.stateVersion = "18.09"; # Did you read the comment?
70
+
71
+}

+ 37
- 0
hosts/containers/logging/configuration.nix View File

@@ -0,0 +1,37 @@
1
+# Edit this configuration file to define what should be installed on
2
+# your system.  Help is available in the configuration.nix(5) man page
3
+# and in the NixOS manual (accessible by running ‘nixos-help’).
4
+
5
+{ config, pkgs, lib, ... }:
6
+
7
+{
8
+  imports =
9
+    [ ../../../lib/lxc-container.nix
10
+    ../../../lib/shared.nix
11
+    ../../../lib/admins.nix
12
+  ];
13
+
14
+  environment.systemPackages = with pkgs; [
15
+    vim
16
+  ];
17
+
18
+  networking = {
19
+    hostName = "logging";
20
+  };
21
+
22
+  nixpkgs.config.allowUnfree = true; 
23
+
24
+  services.openssh = {
25
+    enable = true;
26
+    permitRootLogin = "yes";
27
+  };
28
+
29
+  services.graylog = {
30
+    enable = true;
31
+    passwordSecret = "SDwK3ug9U4gYSVtj3h22i0l57QO6p5RE58sNehAgU3vXgqGa2HuNyhL19vhoUKFqy28rqGfDQkRD5834NqPi5wLsy8H1hz5V";
32
+    elasticsearchHosts = [ "elastic1.serv.zentralwerk.org" ];
33
+  };
34
+
35
+  system.stateVersion = "19.03"; # Did you read the comment?
36
+
37
+}

Loading…
Cancel
Save