ruby_for_grafana_loki 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 585c4f7f187bc40f31942698a8f46c0dd4ed0939ca47c4e692d5ed53b3e712cc
|
4
|
+
data.tar.gz: 29ce38884eb75cc9046b55767256eb999cafc6585606df8de8b620a0962ee891
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00ea45cbd679c2a9c5388f5935b03eb7b61bf7b8a92c06e5c8d653d854da9b71803837dd91721a5fc9455e81c33607e8a661b55ac9678fdd571bd70d8bf13258
|
7
|
+
data.tar.gz: 9beda2ef7e96973cda525d86378213f0d92584596c920e99985779a1e14acc74852a8a33b89fd90204082b490fcf554d59a6d52c7eaf89832f7140ddeb3e2d7e
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module RubyForGrafanaLoki
|
2
2
|
LOGS_TYPE = %w(ERROR WARN FATAL INFO DEBUG).freeze
|
3
|
+
|
3
4
|
class Client
|
4
5
|
include RubyForGrafanaLoki::Request
|
5
6
|
|
@@ -10,9 +11,9 @@ module RubyForGrafanaLoki
|
|
10
11
|
def initialize(log_file_path, allowed_logs_type = LOGS_TYPE)
|
11
12
|
@log_file_path = log_file_path
|
12
13
|
@allowed_logs_type = allowed_logs_type
|
13
|
-
@job_name = "
|
14
|
-
@host_name = "
|
15
|
-
@source_name = "
|
14
|
+
@job_name = "job name"
|
15
|
+
@host_name = "host name"
|
16
|
+
@source_name = "source name"
|
16
17
|
end
|
17
18
|
|
18
19
|
def send_all_logs
|
@@ -53,8 +54,6 @@ module RubyForGrafanaLoki
|
|
53
54
|
post(uri, json_payload)
|
54
55
|
end
|
55
56
|
|
56
|
-
private
|
57
|
-
|
58
57
|
def match_logs_type?(log_line)
|
59
58
|
type = log_line.match(/(ERROR|WARN|FATAL|INFO|DEBUG)/)&.to_s
|
60
59
|
|
@@ -18,7 +18,7 @@ module RubyForGrafanaLoki
|
|
18
18
|
|
19
19
|
# Check if the request was successful
|
20
20
|
if response.success?
|
21
|
-
|
21
|
+
JSON.parse(response.body)
|
22
22
|
else
|
23
23
|
raise "Failed to make POST request. Response code: #{response.status}, Response body: #{response.body}"
|
24
24
|
end
|
@@ -30,7 +30,7 @@ module RubyForGrafanaLoki
|
|
30
30
|
accept: 'application/json',
|
31
31
|
'Content-Type' => 'application/json'
|
32
32
|
}
|
33
|
-
|
33
|
+
{
|
34
34
|
url: BASE_URL,
|
35
35
|
headers: headers
|
36
36
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_for_grafana_loki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Ten
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description:
|
55
|
+
description: Send logs to Grafana Loki
|
56
56
|
email:
|
57
57
|
- tennet0505@gmail.com
|
58
58
|
executables: []
|