fluent-plugin-mssql-lookup 0.1.0 → 0.2.0

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: 30347007dfa3bcff2b5c471d17536e5648a286c6d744686aaf7cef10e9fc689d
4
- data.tar.gz: aa1d888739364b7ebbd503b690aa47f852f909c47f288eb9b84fca653836735f
3
+ metadata.gz: 5a6fc2b343180e385ac7e6f3c97ded78427f344025c3d797c62026c1e7a87a32
4
+ data.tar.gz: 91cf95f6cde9306de5aa54f685ef99ab16f2d292e48872570c8f303fdf96c0e9
5
5
  SHA512:
6
- metadata.gz: 7ee9aae1f11331b2178038f329a004c0d602d59a8ec7171f01822f9ba96e0ca8f554db0f773e1e2f502b37b350623fa6f901673bef2549881dd6057721ce9ffa
7
- data.tar.gz: ed97afa0958cd1923551455bbe877f95cd4ee341f3f35d8e421cabd8e2700cd386fe387dc1c38cefc6a0fb3790e31cc1c9f84a8ea7a09c2e3fec2f3b812d3954
6
+ metadata.gz: f1488be989a295fef5d92c2497e1712a116af3f26414c41da97806b8df7b96450eeec48107bf47b4ec78c08956d186c7c3fbfb11ec1244a026c4c6a5ae898c3c
7
+ data.tar.gz: 40317ca37ce438317cdd68cf8e4b288427a6298b7e3aa988a429e8d60ef6fe4601fc9d067b77cf22220dcffd8d59f67a9dc856722bd6072fa17b53a80e897278
data/.gitignore CHANGED
@@ -6,3 +6,4 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ *.gem
data/README.md CHANGED
@@ -1,8 +1,17 @@
1
1
  # fluent-plugin-mssql-lookup
2
2
 
3
- [Fluentd](https://fluentd.org/) filter plugin to do something.
3
+ [Fluentd](https://fluentd.org/) filter plugin that resolves additional fields via a database lookup
4
4
 
5
- TODO: write description for you plugin.
5
+ In order to communicate with the SQL Server database, we use [FreeTDS](https://www.freetds.org/)
6
+ Consequently this will need to be installed in order to use the plugin.
7
+
8
+ A Docker image has been included that extends the Kubernetes provided one [here](https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/fluentd-elasticsearch/fluentd-es-image)
9
+
10
+ ## Requirements
11
+
12
+ | fluent-plugin-filter-geoip | fluentd | ruby |
13
+ | -------------------------- | --------------- | ------ |
14
+ | 1.x.x | >= 0.14.0, < 2 | >= 2.1 |
6
15
 
7
16
  ## Installation
8
17
 
@@ -26,15 +35,73 @@ And then execute:
26
35
  $ bundle
27
36
  ```
28
37
 
29
- ## Configuration
38
+ ## Config parameters
39
+
40
+ ### db_user
41
+
42
+ The user name to use to connect to the database
43
+
44
+ ```
45
+ db_user myuser
46
+ ```
47
+
48
+ ### db_password
49
+
50
+ The password to use to connect to the database
51
+
52
+ ```
53
+ db_password mypassword
54
+ ```
55
+
56
+ ### db_host
57
+
58
+ The database server host name or ip address
59
+ ```
60
+ db_host mydbserver
61
+ ```
62
+
63
+ ### db_name
64
+
65
+ The name of the database to connect to
66
+ ```
67
+ db_name mydb
68
+ ```
69
+
70
+ ### db_port
71
+
72
+ The database port to connect to (default 1433)
73
+ ```
74
+ db_port 1433
75
+ ```
76
+
77
+ ### lookup_sql
78
+
79
+ The SQL to execute to populate the lookup list
80
+ ```
81
+ lookup_sql "SELECT ID, Field1, Field2 FROM mytable"
82
+ ```
83
+
84
+ ### lookup_key
85
+
86
+ The field within the lookup list that will be used to join to the event key field
87
+ ```
88
+ lookup_key ID
89
+ ```
90
+
91
+ ### lookup_interval
92
+
93
+ The recurring interval (in seconds) at which to refresh the lookup list (default 600)
94
+ ```
95
+ lookup_interval 1200
96
+ ```
30
97
 
31
- You can generate configuration template:
98
+ ### key
32
99
 
100
+ The key field in the event
33
101
  ```
34
- $ fluent-plugin-config-format filter mssql-lookup
102
+ key id
35
103
  ```
36
104
 
37
- You can copy and paste generated documents here.
38
105
 
39
106
  ## Copyright
40
107
 
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "fluent-plugin-mssql-lookup"
6
- spec.version = "0.1.0"
6
+ spec.version = "0.2.0"
7
7
  spec.authors = ["Alastair Hails"]
8
8
  spec.email = ["alastairhails@datasoftcomputing.com"]
9
9
 
@@ -29,13 +29,20 @@ COPY Gemfile /Gemfile
29
29
  # 2. Install fluentd via ruby.
30
30
  # 3. Remove build dependencies.
31
31
  # 4. Cleanup leftover caches & files.
32
- RUN BUILD_DEPS="make gcc g++ libc6-dev ruby-dev libffi-dev" \
32
+ RUN BUILD_DEPS="make gcc g++ libc6-dev ruby-dev libffi-dev wget build-essential" \
33
33
  && clean-install $BUILD_DEPS \
34
34
  ca-certificates \
35
35
  libjemalloc1 \
36
36
  ruby \
37
37
  && echo 'gem: --no-document' >> /etc/gemrc \
38
38
  && gem install --file Gemfile \
39
+ && wget http://www.freetds.org/files/stable/freetds-1.1.21.tar.gz \
40
+ && tar -xzf freetds-1.1.21.tar.gz \
41
+ && cd freetds-1.1.21 \
42
+ && ./configure \
43
+ && make \
44
+ && make install \
45
+ && gem install tiny_tds \
39
46
  && apt-get purge -y --auto-remove \
40
47
  -o APT::AutoRemove::RecommendsImportant=false \
41
48
  $BUILD_DEPS \
@@ -43,15 +50,6 @@ RUN BUILD_DEPS="make gcc g++ libc6-dev ruby-dev libffi-dev" \
43
50
  # Ensure fluent has enough file descriptors
44
51
  && ulimit -n 65536
45
52
 
46
- # Install FreeTDS
47
- RUN clean-install wget build-essential \
48
- && wget http://www.freetds.org/files/stable/freetds-1.1.21.tar.gz \
49
- && tar -xzf freetds-1.1.21.tar.gz \
50
- && cd freetds-1.1.21 \
51
- && ./configure \
52
- && make \
53
- && make install
54
-
55
53
  # Copy the Fluentd configuration file for logging Docker container logs.
56
54
  COPY fluent.conf /etc/fluent/fluent.conf
57
55
  COPY run.sh /run.sh
@@ -7,6 +7,6 @@ gem 'fluent-plugin-detect-exceptions', '~>0.0.12'
7
7
  gem 'fluent-plugin-elasticsearch', '~>3.5.3'
8
8
  gem 'fluent-plugin-kubernetes_metadata_filter', '~>2.2.0'
9
9
  gem 'fluent-plugin-multi-format-parser', '~>1.0.0'
10
- gem 'fluent-plugin-prometheus', '~>1.4.0'
10
+ gem 'fluent-plugin-prometheus', '~>1.6.1'
11
11
  gem 'fluent-plugin-systemd', '~>1.0.2'
12
12
  gem 'oj', '~>3.8.1'
@@ -17,7 +17,7 @@
17
17
 
18
18
  PREFIX = quay.io/datasoft-computing
19
19
  IMAGE = fluentd
20
- TAG = v1.0.0
20
+ TAG = v1.0.1
21
21
 
22
22
  build:
23
23
  docker build --tag ${PREFIX}/${IMAGE}:${TAG} .
@@ -28,6 +28,7 @@ module Fluent
28
28
  config_param :db_port, :integer, :default => 1433, :desc => 'Database port'
29
29
  config_param :lookup_sql, :string, :desc => 'SQL script to execute to refresh the lookup'
30
30
  config_param :lookup_key, :string, :desc => 'Key to join on in the returned results'
31
+ config_param :lookup_interval, :integer, :default => 600, :desc => 'Interval at which to refresh the lookup list in seconds'
31
32
  config_param :key, :string, :desc => 'Field in the event that links to the lookup'
32
33
 
33
34
  helpers :timer
@@ -42,7 +43,7 @@ module Fluent
42
43
  super
43
44
 
44
45
  lookup_refresh
45
- timer_execute(:refresh_timer, 30) do
46
+ timer_execute(:refresh_timer, @lookup_interval) do
46
47
  lookup_refresh
47
48
  end
48
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-mssql-lookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alastair Hails