From 1af13fe2c372cafca72b313e129de68304b5facc Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Fri, 11 Oct 2019 01:59:10 +0200 Subject: [PATCH] Add filebeat integration License: MIT Signed-off-by: Jakub Sztandera --- scripts/daemon.service | 4 ++- scripts/filebeat.yml | 66 ++++++++++++++++++++++++++++++++++++++++++ scripts/sminer.service | 2 ++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 scripts/filebeat.yml diff --git a/scripts/daemon.service b/scripts/daemon.service index 2055e4371..8d93518b5 100644 --- a/scripts/daemon.service +++ b/scripts/daemon.service @@ -4,6 +4,8 @@ After=network.target [Service] ExecStart=/usr/local/bin/lotus daemon +Environment=GOLOG_FILE="/root/.lotus/logs" +Environment=GOLOG_LOG_FMT="json" [Install] -WantedBy=multiuser.target \ No newline at end of file +WantedBy=multiuser.target diff --git a/scripts/filebeat.yml b/scripts/filebeat.yml new file mode 100644 index 000000000..0a027b655 --- /dev/null +++ b/scripts/filebeat.yml @@ -0,0 +1,66 @@ +############################# Filebeat ##################################### + +filebeat.inputs: + +- type: log + paths: + - /root/.lotusstorage/logs + fields: + logzio_codec: json + token: + type: lotus-miner + fields_under_root: true + json.keys_under_root: false + encoding: utf-8 + ignore_older: 3h +- type: log + paths: + - /root/.lotus/logs + fields: + logzio_codec: json + token: + type: lotus-daemon + fields_under_root: true + json.keys_under_root: false + encoding: utf-8 + ignore_older: 3h + +#For version 6.x and lower +#filebeat.registry_file: /var/lib/filebeat/registry + +#For version 7 and higher +filebeat.registry.path: /var/lib/filebeat + +#The following processors are to ensure compatibility with version 7 +processors: +- rename: + fields: + - from: "agent" + to: "beat_agent" + ignore_missing: true +- rename: + fields: + - from: "log.file.path" + to: "source" + ignore_missing: true + +- if: + has_fields: ['json.ts'] + then: + - timestamp: + field: 'json.ts' + layouts: + - '2006-01-02T15:04:05.000Z0700' + test: + - '2019-10-10T22:37:48.297+0200' + - drop_fields: + fields: ['json.ts'] + + +############################# Output ########################################## + +output: + logstash: + hosts: ["listener.logz.io:5015"] + ssl: + certificate_authorities: ['/etc/pki/tls/certs/COMODORSADomainValidationSecureServerCA.crt'] diff --git a/scripts/sminer.service b/scripts/sminer.service index c5453ef06..ed966a5d2 100644 --- a/scripts/sminer.service +++ b/scripts/sminer.service @@ -4,6 +4,8 @@ After=network.target [Service] ExecStart=/usr/local/bin/lotus-storage-miner run +Environment=GOLOG_FILE="/root/.lotusstorage/logs" +Environment=GOLOG_LOG_FMT="json" [Install] WantedBy=multiuser.target