fluent-plugin-vmware-loginsight 0.1.10 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,30 +23,32 @@ data:
23
23
  myapp-fluent.conf: |
24
24
  # Input sources
25
25
  @include general.conf
26
- @include systemd-input.conf
27
- @include kubernetes-input.conf
28
-
29
- # Parsing/Filtering
30
- @include kubernetes-filter.conf
26
+ @include systemd.conf
27
+ @include kubernetes.conf
28
+ @include kube-audit.conf
31
29
 
32
30
  # Forwading - Be vigilant of the order in which these plugins are specified. Order matters!
33
- @include myapp-loginsight-output.conf
31
+ @include vmw-li.conf
34
32
 
35
33
  general.conf: |
36
34
  <system>
37
35
  log_level info
38
36
  </system>
39
37
  # Prevent fluentd from handling records containing its own logs to handle cycles.
40
- <match fluent.**>
41
- @type null
42
- </match>
38
+ <label @FLUENT_LOG>
39
+ <match fluent.**>
40
+ @type null
41
+ </match>
42
+ </label>
43
43
 
44
- systemd-input.conf: |
44
+ systemd.conf: |
45
+ # Journal logs
45
46
  <source>
46
47
  @type systemd
48
+ @id in_systemd_logs
47
49
  path /run/log/journal
48
50
  # Can filter logs if we want, e.g.
49
- # filters [{ "_SYSTEMD_UNIT": "kubelet.service" }]
51
+ #filters [{ "_SYSTEMD_UNIT": "kubelet.service" }]
50
52
  <storage>
51
53
  @type local
52
54
  persistent true
@@ -57,70 +59,114 @@ data:
57
59
  strip_underscores true
58
60
  </source>
59
61
 
60
- kubernetes-input.conf: |
62
+ kubernetes.conf: |
63
+ # Container logs
64
+ # Kubernetes docker logs are stored under /var/lib/docker/containers for
65
+ # which kubernetes creates a symlink at /var/log/containers
61
66
  <source>
62
67
  @type tail
68
+ @id in_tail_container_logs
63
69
  path /var/log/containers/*.log
64
70
  # One could exclude certain logs like:
65
- # exclude_path ["/var/log/containers/log-collector*.log"]
71
+ #exclude_path ["/var/log/containers/log-collector*.log"]
66
72
  pos_file /var/log/fluentd-docker.pos
67
- time_format %Y-%m-%dT%H:%M:%S
68
- tag kubernetes.*
69
- format json
70
73
  read_from_head true
74
+ # Set this watcher to false if you have many files to tail
75
+ enable_stat_watcher false
76
+ refresh_interval 5
77
+ tag kubernetes.*
78
+ <parse>
79
+ @type json
80
+ time_key time
81
+ keep_time_key true
82
+ time_format %Y-%m-%dT%H:%M:%S.%NZ
83
+ </parse>
71
84
  </source>
72
-
73
- kubernetes-filter.conf: |
85
+ # Kubernetes metadata filter that tags additional meta data for each container event
74
86
  <filter kubernetes.**>
75
87
  @type kubernetes_metadata
76
- merge_json_log true
77
- preserve_json_log true
88
+ @id filter_kube_metadata
89
+ kubernetes_url "#{ENV['FLUENT_FILTER_KUBERNETES_URL'] || 'https://' + ENV.fetch('KUBERNETES_SERVICE_HOST') + ':' + ENV. fetch('KUBERNETES_SERVICE_PORT') + '/api'}"
90
+ verify_ssl "#{ENV['KUBERNETES_VERIFY_SSL'] || true}"
91
+ ca_file "#{ENV['KUBERNETES_CA_FILE']}"
92
+ skip_labels "#{ENV['FLUENT_KUBERNETES_METADATA_SKIP_LABELS'] || 'false'}"
93
+ skip_container_metadata "#{ENV['FLUENT_KUBERNETES_METADATA_SKIP_CONTAINER_METADATA'] || 'false'}"
94
+ skip_master_url "#{ENV['FLUENT_KUBERNETES_METADATA_SKIP_MASTER_URL'] || 'false'}"
95
+ skip_namespace_metadata "#{ENV['FLUENT_KUBERNETES_METADATA_SKIP_NAMESPACE_METADATA'] || 'false'}"
96
+ </filter>
97
+
98
+ # Prefix the tag by namespace. This would make it easy to match logs by namespaces
99
+ <match kubernetes.**>
100
+ @type rewrite_tag_filter
101
+ <rule>
102
+ key $.kubernetes.namespace_name
103
+ pattern ^(.+)$
104
+ tag $1.${tag}
105
+ </rule>
106
+ </match>
107
+
108
+ kube-audit.conf: |
109
+ # Kube-apiserver audit logs
110
+ <source>
111
+ @type tail
112
+ @id in_tail_kube_audit_logs
113
+ # path to audit logs for kube-apiserver
114
+ path "/var/log/kube-audit/audit.log"
115
+ pos_file /var/log/kube-audit.pos
116
+ tag kube-audit
117
+ <parse>
118
+ @type json
119
+ time_key timestamp
120
+ keep_time_key false
121
+ time_format %Y-%m-%dT%H:%M:%SZ
122
+ </parse>
123
+ </source>
124
+ # Loginsight doesn't support ingesting `source` as a field name, get rid of it
125
+ <filter kube-audit>
126
+ @type record_transformer
127
+ @id filter_kube_audit_logs
128
+ enable_ruby
129
+ remove_keys source
130
+ <record>
131
+ log ${record}
132
+ </record>
78
133
  </filter>
79
134
 
80
- myapp-loginsight-output.conf: |
135
+ vmw-li.conf: |
136
+ # Match everything
81
137
  # We are capturing all log messages and redirecting them to endpoints mentioned in each <store> tag.
82
138
  # One may redirect these logs to muliple endpoints (including multiple LI instances).
83
139
  # Or one may chose to tag their specific logs and add their own config to capture those tagged logs and redirect
84
- # them to appropriate endpoint. This specific config needs to preceed this generic one.
140
+ # them to appropriate endpoint. That specific config needs to preceed this generic one.
85
141
  <match **>
86
142
  @type copy
87
143
  <store>
88
144
  @type vmware_loginsight
145
+ @id out_vmw_li_all_container_logs
89
146
  scheme https
90
147
  ssl_verify true
91
148
  # Loginsight host: One may use IP address or cname
92
- # host X.X.X.X
93
- host my-loginsight.mycompany.com
94
- port 9000
95
- path api/v1/events/ingest
149
+ #host X.X.X.X
150
+ host MY_LOGINSIGHT_HOST
151
+ port 9543
96
152
  agent_id XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
97
- http_method post
98
- serializer json
99
- rate_limit_msec 0
100
- raise_on_error false
101
- include_tag_key true
102
- tag_key tag
153
+ # Keys from log event whose values should be added as log message/text to
154
+ # Loginsight. Note these key/value pairs won't be added as metadata/fields
155
+ log_text_keys ["log","msg","message"]
156
+ # Use this flag if you want to enable http debug logs
157
+ http_conn_debug false
103
158
  </store>
104
- # If we want to debug and send logs to stdout as well
105
- # <store>
106
- # @type stdout
107
- # </store>
159
+ # copy plugin supports sending/copying logs to multiple plugins
160
+ # One may choose to send them to multiple LIs
161
+ # Or one may want send a copy to stdout for debugging
162
+ # Please note, if you use stdout along with LI, catch the logger's log to make
163
+ # sure they're not cyclic
164
+ #<store>
165
+ # @type stdout
166
+ #</store>
108
167
  </match>
109
168
 
110
169
 
111
- extra.conf: |
112
- # If we want to transform events we could use:
113
- #<filter **>
114
- # @type record_transformer
115
- # enable_ruby
116
- # auto_typecast
117
- # <record>
118
- # hostname "#{Socket.gethostname}"
119
- # mykey ${["message"=>record.to_json]}
120
- # </record>
121
- #</filter>
122
-
123
-
124
170
  ---
125
171
  kind: DaemonSet
126
172
  apiVersion: extensions/v1beta1
@@ -131,8 +177,21 @@ metadata:
131
177
  app: "log-collector"
132
178
  version: v1
133
179
  spec:
180
+ selector:
181
+ matchLabels:
182
+ app: "log-collector"
183
+ revisionHistoryLimit: 3
184
+ minReadySeconds: 10
185
+ updateStrategy:
186
+ type: RollingUpdate
187
+ rollingUpdate:
188
+ # How many pods can be unavailable during the rolling update.
189
+ maxUnavailable: 3
134
190
  template:
135
191
  metadata:
192
+ annotations:
193
+ # One may use this annotation to trigger rollout whenever fluentd config changes
194
+ configHash: GENERATED_HASH
136
195
  labels:
137
196
  app: "log-collector"
138
197
  version: v1
@@ -14,7 +14,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
14
14
 
15
15
  Gem::Specification.new do |spec|
16
16
  spec.name = "fluent-plugin-vmware-loginsight"
17
- spec.version = "0.1.10"
17
+ spec.version = File.read("VERSION").strip
18
18
  spec.authors = ["Vishal Mohite", "Chris Todd"]
19
19
  spec.email = ["vmohite@vmware.com", "toddc@vmware.com"]
20
20
 
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.test_files = test_files
32
32
  spec.require_paths = ["lib"]
33
33
 
34
- spec.add_development_dependency "bundler", "~> 1.14"
34
+ spec.add_development_dependency "bundler", ">= 2.1.0"
35
35
  spec.add_development_dependency "rake", "~> 12.0"
36
36
  spec.add_development_dependency "test-unit", "~> 3.0"
37
37
  spec.add_runtime_dependency "fluentd", [">= 0.14.10", "< 2"]