logstash-filter-k8s 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +2 -0
- data/LICENSE +21 -0
- data/README.md +110 -0
- data/lib/logstash/filters/kubernetes.rb +78 -0
- data/logstash-filter-k8s.gemspec +23 -0
- data/spec/filters/kubernetes_spec.rb +66 -0
- data/spec/fixtures/container-json.log +136 -0
- data/spec/fixtures/pod-json.log +93 -0
- data/spec/spec_helper.rb +1 -0
- metadata +92 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8eb559ab3a707ff55ceafdd8aafd29fee0243f37
|
4
|
+
data.tar.gz: b3013e311df129464acff4f0f14b0a1215eac95d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0d83773a0e098ea056f2c5f6b398f5c700c2393d79ff9a3f115e91cc013e9e847c9d8ab3ac300b6b6edf38ab3042165441e658adc0db129fee735d112bfb8219
|
7
|
+
data.tar.gz: 44011901ad40065f9c5c5c10a7311bce3cc18b76b2067f5110e859460885f92a712fb1c226d90e8459e1a92d3b6d439f5673d7165468390fa628ab0b5683e68d
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2016 Checkr
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# Logstash Plugin
|
2
|
+
|
3
|
+
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
4
|
+
|
5
|
+
Rubygems: https://rubygems.org/gems/logstash-filter-k8s
|
6
|
+
|
7
|
+
## Documentation
|
8
|
+
|
9
|
+
This plugin does not require access to Kubernetes API.
|
10
|
+
|
11
|
+
### Example configuration
|
12
|
+
```ruby
|
13
|
+
input {
|
14
|
+
file {
|
15
|
+
# Path to to docker logs
|
16
|
+
path => "/var/lib/docker/containers/**/*-json.log"
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
filter {
|
21
|
+
kubernetes {}
|
22
|
+
}
|
23
|
+
|
24
|
+
output {
|
25
|
+
stdout {}
|
26
|
+
}
|
27
|
+
```
|
28
|
+
|
29
|
+
If you're running logstash in a container, make sure that you mount both,
|
30
|
+
`/var/log/containers` and `/var/lib/docker/containers` for logstash input to be
|
31
|
+
able to follow symlinks.
|
32
|
+
|
33
|
+
Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
|
34
|
+
|
35
|
+
- For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
|
36
|
+
- For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
|
37
|
+
|
38
|
+
## Need Help?
|
39
|
+
|
40
|
+
Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
|
41
|
+
|
42
|
+
## Developing
|
43
|
+
|
44
|
+
### 1. Plugin Developement and Testing
|
45
|
+
|
46
|
+
#### Code
|
47
|
+
- To get started, you'll need JRuby with the Bundler gem installed.
|
48
|
+
|
49
|
+
- Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example).
|
50
|
+
|
51
|
+
- Install dependencies
|
52
|
+
```sh
|
53
|
+
bundle install
|
54
|
+
```
|
55
|
+
|
56
|
+
#### Test
|
57
|
+
|
58
|
+
- Update your dependencies
|
59
|
+
|
60
|
+
```sh
|
61
|
+
bundle install
|
62
|
+
```
|
63
|
+
|
64
|
+
- Run tests
|
65
|
+
|
66
|
+
```sh
|
67
|
+
bundle exec rspec
|
68
|
+
```
|
69
|
+
|
70
|
+
### 2. Running your unpublished Plugin in Logstash
|
71
|
+
|
72
|
+
#### 2.1 Run in a local Logstash clone
|
73
|
+
|
74
|
+
- Edit Logstash `Gemfile` and add the local plugin path, for example:
|
75
|
+
```ruby
|
76
|
+
gem "logstash-filter-k8s", :path => "/your/local/logstash-filter-k8s"
|
77
|
+
```
|
78
|
+
- Install plugin
|
79
|
+
```sh
|
80
|
+
bin/plugin install --no-verify
|
81
|
+
```
|
82
|
+
- Run Logstash with your plugin
|
83
|
+
```sh
|
84
|
+
bin/logstash -e 'filter {kubernetes {}}'
|
85
|
+
```
|
86
|
+
At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
|
87
|
+
|
88
|
+
#### 2.2 Run in an installed Logstash
|
89
|
+
|
90
|
+
You can use the same **2.1** method to run your plugin in an installed Logstash by editing its `Gemfile` and pointing the `:path` to your local plugin development directory or you can build the gem and install it using:
|
91
|
+
|
92
|
+
- Build your plugin gem
|
93
|
+
```sh
|
94
|
+
gem build logstash-filter-k8s.gemspec
|
95
|
+
```
|
96
|
+
- Install the plugin from the Logstash home
|
97
|
+
```sh
|
98
|
+
bin/plugin install /your/local/plugin/logstash-filter-k8s.gem
|
99
|
+
```
|
100
|
+
- Start Logstash and proceed to test the plugin
|
101
|
+
|
102
|
+
## Contributing
|
103
|
+
|
104
|
+
All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
|
105
|
+
|
106
|
+
Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.
|
107
|
+
|
108
|
+
It is more important to the community that you are able to contribute.
|
109
|
+
|
110
|
+
For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/filters/base"
|
3
|
+
require "logstash/namespace"
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
# This filter plugin allows you extract Pod, Namespace, etc from kubernetes.
|
7
|
+
# The way this filter works is very simple. It looks at an event field which
|
8
|
+
# contains full path to kubelet created symlinks to docker container logs and
|
9
|
+
# extracts useful information from a symlink name. No access to Kubernetes API
|
10
|
+
# is required.
|
11
|
+
class LogStash::Filters::Kubernetes < LogStash::Filters::Base
|
12
|
+
|
13
|
+
# This is how you configure this filter from your Logstash config.
|
14
|
+
#
|
15
|
+
# Example:
|
16
|
+
# [source,ruby]
|
17
|
+
# input {
|
18
|
+
# file {
|
19
|
+
# # Path to kubelet symlinks to docker logs, by default, symlinks look like
|
20
|
+
# # /var/lib/docker/containers/*/*-json.log
|
21
|
+
# path => "/var/lib/docker/containers/*/*-json.log"
|
22
|
+
# }
|
23
|
+
# }
|
24
|
+
#
|
25
|
+
# filter {
|
26
|
+
# kubernetes {
|
27
|
+
# source => "path"
|
28
|
+
# target => "kubernetes"
|
29
|
+
# }
|
30
|
+
# }
|
31
|
+
#
|
32
|
+
config_name "kubernetes"
|
33
|
+
|
34
|
+
# The source field name which contains full path to kubelet log file.
|
35
|
+
config :source, :validate => :string, :default => "path"
|
36
|
+
|
37
|
+
# The target field name to write event kubernetes metadata.
|
38
|
+
config :target, :validate => :string, :default => "kubernetes"
|
39
|
+
|
40
|
+
|
41
|
+
public
|
42
|
+
def register
|
43
|
+
@cached = Hash.new
|
44
|
+
end
|
45
|
+
|
46
|
+
public
|
47
|
+
def filter(event)
|
48
|
+
if @source
|
49
|
+
parts = event[@source].split(File::SEPARATOR)
|
50
|
+
container_id = parts.last.gsub(/-json.log$/, '')
|
51
|
+
|
52
|
+
unless @cached.has_key?(container_id)
|
53
|
+
config_path = parts[0...-1].push("config.v2.json").join(File::SEPARATOR)
|
54
|
+
config_json = File.read(config_path)
|
55
|
+
config = JSON.parse(config_json)
|
56
|
+
return if config.empty?
|
57
|
+
|
58
|
+
kubernetes = {}
|
59
|
+
kubernetes['pod'] = config["Config"]["Labels"]["io.kubernetes.pod.name"]
|
60
|
+
kubernetes['namespace'] = config["Config"]["Labels"]["io.kubernetes.pod.namespace"]
|
61
|
+
kubernetes['container_name'] = config["Config"]["Labels"]["io.kubernetes.container.name"]
|
62
|
+
kubernetes['container_id'] = container_id
|
63
|
+
kubernetes['image'] = config["Config"]["Image"]
|
64
|
+
kubernetes['container_hash'] = config["Config"]["Labels"]["io.kubernetes.container.hash"]
|
65
|
+
|
66
|
+
@cached[container_id] = kubernetes
|
67
|
+
end
|
68
|
+
|
69
|
+
# We do not care about POD log files
|
70
|
+
return if @cached[container_id]["container_name"] == "POD"
|
71
|
+
|
72
|
+
event[@target] = @cached[container_id]
|
73
|
+
end
|
74
|
+
|
75
|
+
# filter_matched should go in the last line of our successful code
|
76
|
+
filter_matched(event)
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'logstash-filter-k8s'
|
3
|
+
s.version = '0.1.0'
|
4
|
+
s.licenses = ['MIT']
|
5
|
+
s.summary = "This filter extracts useful kubernetes information from kubelet logfile symlinks."
|
6
|
+
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
|
7
|
+
s.authors = ["Saso Matejina"]
|
8
|
+
s.email = 'saso@checkr.com'
|
9
|
+
s.homepage = "https://github.com/checkr/logstash-filter-k8s"
|
10
|
+
s.require_paths = ["lib"]
|
11
|
+
|
12
|
+
# Files
|
13
|
+
s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','Gemfile','LICENSE']
|
14
|
+
# Tests
|
15
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
16
|
+
|
17
|
+
# Special flag to let us know this is actually a logstash plugin
|
18
|
+
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
|
19
|
+
|
20
|
+
# Gem dependencies
|
21
|
+
s.add_runtime_dependency "logstash-core", ">= 2.0.0", "< 3.0.0"
|
22
|
+
s.add_development_dependency 'logstash-devutils', '~> 0'
|
23
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require "logstash/filters/kubernetes"
|
3
|
+
|
4
|
+
describe LogStash::Filters::Kubernetes do
|
5
|
+
describe "Split path into kubernetes key-value pairs." do
|
6
|
+
let(:json_file) do
|
7
|
+
File.read(__dir__ + "/../fixtures/container-json.log")
|
8
|
+
end
|
9
|
+
let(:config) do <<-CONFIG
|
10
|
+
filter {
|
11
|
+
kubernetes {
|
12
|
+
source => "path"
|
13
|
+
}
|
14
|
+
}
|
15
|
+
CONFIG
|
16
|
+
end
|
17
|
+
|
18
|
+
sample("path" => "/var/lib/docker/containers/c4d8a8c986fac347a93b085a0677d0672b2caaba7845a513d0ba9b5176fd1b53/c4d8a8c986fac347a93b085a0677d0672b2caaba7845a513d0ba9b5176fd1b53-json.log") do
|
19
|
+
allow(File).to receive(:read).and_return(json_file)
|
20
|
+
insist { subject["kubernetes"] } == {"pod"=>"checkr-dashboard-deployment-1223682821-04fkp", "namespace"=>"default", "container_name"=>"checkr-dashboard", "container_id"=>"c4d8a8c986fac347a93b085a0677d0672b2caaba7845a513d0ba9b5176fd1b53", "image"=>"checkr/dashboard:saso", "container_hash"=>"8c095b3d"}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe LogStash::Filters::Kubernetes do
|
26
|
+
describe "Set target field name." do
|
27
|
+
let(:json_file) do
|
28
|
+
File.read(__dir__ + "/../fixtures/container-json.log")
|
29
|
+
end
|
30
|
+
let(:config) do <<-CONFIG
|
31
|
+
filter {
|
32
|
+
kubernetes {
|
33
|
+
source => "path"
|
34
|
+
target => "foobar"
|
35
|
+
}
|
36
|
+
}
|
37
|
+
CONFIG
|
38
|
+
end
|
39
|
+
|
40
|
+
sample("path" => "/var/lib/docker/containers/c4d8a8c986fac347a93b085a0677d0672b2caaba7845a513d0ba9b5176fd1b53/c4d8a8c986fac347a93b085a0677d0672b2caaba7845a513d0ba9b5176fd1b53-json.log") do
|
41
|
+
allow(File).to receive(:read).and_return(json_file)
|
42
|
+
insist { subject["foobar"] } == {"pod"=>"checkr-dashboard-deployment-1223682821-04fkp", "namespace"=>"default", "container_name"=>"checkr-dashboard", "container_id"=>"c4d8a8c986fac347a93b085a0677d0672b2caaba7845a513d0ba9b5176fd1b53", "image"=>"checkr/dashboard:saso", "container_hash"=>"8c095b3d"}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe LogStash::Filters::Kubernetes do
|
48
|
+
describe "Skip parsing empty POD event." do
|
49
|
+
let(:json_file) do
|
50
|
+
File.read(__dir__ + "/../fixtures/pod-json.log")
|
51
|
+
end
|
52
|
+
let(:config) do <<-CONFIG
|
53
|
+
filter {
|
54
|
+
kubernetes {
|
55
|
+
source => "path"
|
56
|
+
}
|
57
|
+
}
|
58
|
+
CONFIG
|
59
|
+
end
|
60
|
+
|
61
|
+
sample("path" => "/var/lib/docker/containers/c4d8a8c986fac347a93b085a0677d0672b2caaba7845a513d0ba9b5176fd1b53/c4d8a8c986fac347a93b085a0677d0672b2caaba7845a513d0ba9b5176fd1b53-json.log") do
|
62
|
+
allow(File).to receive(:read).and_return(json_file)
|
63
|
+
insist { subject["kubernetes"] } == nil
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
{
|
2
|
+
"State": {
|
3
|
+
"Running": true,
|
4
|
+
"Paused": false,
|
5
|
+
"Restarting": false,
|
6
|
+
"OOMKilled": false,
|
7
|
+
"RemovalInProgress": false,
|
8
|
+
"Dead": false,
|
9
|
+
"Pid": 19087,
|
10
|
+
"ExitCode": 0,
|
11
|
+
"Error": "",
|
12
|
+
"StartedAt": "2016-09-07T05:27:32.864628347Z",
|
13
|
+
"FinishedAt": "0001-01-01T00:00:00Z"
|
14
|
+
},
|
15
|
+
"ID": "c4d8a8c986fac347a93b085a0677d0672b2caaba7845a513d0ba9b5176fd1b53",
|
16
|
+
"Created": "2016-09-07T05:27:32.487019957Z",
|
17
|
+
"Path": "node",
|
18
|
+
"Args": [
|
19
|
+
"app.js"
|
20
|
+
],
|
21
|
+
"Config": {
|
22
|
+
"Hostname": "checkr-dashboard-deployment-1223682821-04fkp",
|
23
|
+
"Domainname": "",
|
24
|
+
"User": "",
|
25
|
+
"AttachStdin": false,
|
26
|
+
"AttachStdout": false,
|
27
|
+
"AttachStderr": false,
|
28
|
+
"ExposedPorts": {
|
29
|
+
"3000/tcp": {}
|
30
|
+
},
|
31
|
+
"Tty": false,
|
32
|
+
"OpenStdin": false,
|
33
|
+
"StdinOnce": false,
|
34
|
+
"Env": [
|
35
|
+
"NODE_ENV=production",
|
36
|
+
"KUBERNETES_SERVICE_HOST=10.3.0.1",
|
37
|
+
"KUBERNETES_SERVICE_PORT_HTTPS=443",
|
38
|
+
"KUBERNETES_PORT_443_TCP=tcp://10.3.0.1:443",
|
39
|
+
"KUBERNETES_PORT_443_TCP_PROTO=tcp",
|
40
|
+
"CHECKR_DASHBOARD_SERVICE_PORT_HTTPS=443",
|
41
|
+
"CHECKR_DASHBOARD_PORT=tcp://10.3.0.78:443",
|
42
|
+
"KUBERNETES_PORT=tcp://10.3.0.1:443",
|
43
|
+
"KUBERNETES_PORT_443_TCP_PORT=443",
|
44
|
+
"KUBERNETES_PORT_443_TCP_ADDR=10.3.0.1",
|
45
|
+
"CHECKR_DASHBOARD_PORT_443_TCP=tcp://10.3.0.78:443",
|
46
|
+
"CHECKR_DASHBOARD_PORT_443_TCP_PORT=443",
|
47
|
+
"CHECKR_DASHBOARD_PORT_443_TCP_PROTO=tcp",
|
48
|
+
"CHECKR_DASHBOARD_PORT_443_TCP_ADDR=10.3.0.78",
|
49
|
+
"KUBERNETES_SERVICE_PORT=443",
|
50
|
+
"CHECKR_DASHBOARD_SERVICE_HOST=10.3.0.78",
|
51
|
+
"CHECKR_DASHBOARD_SERVICE_PORT=443",
|
52
|
+
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
53
|
+
"NODE_VERSION=0.12.10",
|
54
|
+
"APP=/app"
|
55
|
+
],
|
56
|
+
"Cmd": null,
|
57
|
+
"Image": "checkr/dashboard:saso",
|
58
|
+
"Volumes": null,
|
59
|
+
"WorkingDir": "/app",
|
60
|
+
"Entrypoint": [
|
61
|
+
"node",
|
62
|
+
"app.js"
|
63
|
+
],
|
64
|
+
"OnBuild": null,
|
65
|
+
"Labels": {
|
66
|
+
"io.kubernetes.container.hash": "8c095b3d",
|
67
|
+
"io.kubernetes.container.name": "checkr-dashboard",
|
68
|
+
"io.kubernetes.container.restartCount": "0",
|
69
|
+
"io.kubernetes.container.terminationMessagePath": "/dev/termination-log",
|
70
|
+
"io.kubernetes.pod.name": "checkr-dashboard-deployment-1223682821-04fkp",
|
71
|
+
"io.kubernetes.pod.namespace": "default",
|
72
|
+
"io.kubernetes.pod.terminationGracePeriod": "30",
|
73
|
+
"io.kubernetes.pod.uid": "c63bf8b0-74bb-11e6-ab1f-0e245a15209f"
|
74
|
+
}
|
75
|
+
},
|
76
|
+
"Image": "sha256:376cdfcde99dae6c9232ab8b2d95f6578f0cbfdb833811a28168a85dda617c31",
|
77
|
+
"NetworkSettings": {
|
78
|
+
"Bridge": "",
|
79
|
+
"SandboxID": "",
|
80
|
+
"HairpinMode": false,
|
81
|
+
"LinkLocalIPv6Address": "",
|
82
|
+
"LinkLocalIPv6PrefixLen": 0,
|
83
|
+
"Networks": null,
|
84
|
+
"Ports": null,
|
85
|
+
"SandboxKey": "",
|
86
|
+
"SecondaryIPAddresses": null,
|
87
|
+
"SecondaryIPv6Addresses": null,
|
88
|
+
"IsAnonymousEndpoint": false
|
89
|
+
},
|
90
|
+
"LogPath": "/var/lib/docker/containers/c4d8a8c986fac347a93b085a0677d0672b2caaba7845a513d0ba9b5176fd1b53/c4d8a8c986fac347a93b085a0677d0672b2caaba7845a513d0ba9b5176fd1b53-json.log",
|
91
|
+
"Name": "/k8s_checkr-dashboard.8c095b3d_checkr-dashboard-deployment-1223682821-04fkp_default_c63bf8b0-74bb-11e6-ab1f-0e245a15209f_5f71f056",
|
92
|
+
"Driver": "overlay",
|
93
|
+
"MountLabel": "system_u:object_r:svirt_lxc_file_t:s0:c113,c800",
|
94
|
+
"ProcessLabel": "system_u:system_r:svirt_lxc_net_t:s0:c113,c800",
|
95
|
+
"RestartCount": 0,
|
96
|
+
"HasBeenStartedBefore": true,
|
97
|
+
"HasBeenManuallyStopped": false,
|
98
|
+
"MountPoints": {
|
99
|
+
"/dev/termination-log": {
|
100
|
+
"Source": "/var/lib/kubelet/pods/c63bf8b0-74bb-11e6-ab1f-0e245a15209f/containers/checkr-dashboard/5f71f056",
|
101
|
+
"Destination": "/dev/termination-log",
|
102
|
+
"RW": true,
|
103
|
+
"Name": "",
|
104
|
+
"Driver": "",
|
105
|
+
"Relabel": "",
|
106
|
+
"Propagation": "rprivate",
|
107
|
+
"Named": false
|
108
|
+
},
|
109
|
+
"/etc/hosts": {
|
110
|
+
"Source": "/var/lib/kubelet/pods/c63bf8b0-74bb-11e6-ab1f-0e245a15209f/etc-hosts",
|
111
|
+
"Destination": "/etc/hosts",
|
112
|
+
"RW": true,
|
113
|
+
"Name": "",
|
114
|
+
"Driver": "",
|
115
|
+
"Relabel": "",
|
116
|
+
"Propagation": "rprivate",
|
117
|
+
"Named": false
|
118
|
+
},
|
119
|
+
"/var/run/secrets/kubernetes.io/serviceaccount": {
|
120
|
+
"Source": "/var/lib/kubelet/pods/c63bf8b0-74bb-11e6-ab1f-0e245a15209f/volumes/kubernetes.io~secret/default-token-84c3k",
|
121
|
+
"Destination": "/var/run/secrets/kubernetes.io/serviceaccount",
|
122
|
+
"RW": false,
|
123
|
+
"Name": "",
|
124
|
+
"Driver": "",
|
125
|
+
"Relabel": "ro",
|
126
|
+
"Propagation": "rprivate",
|
127
|
+
"Named": false
|
128
|
+
}
|
129
|
+
},
|
130
|
+
"AppArmorProfile": "",
|
131
|
+
"HostnamePath": "/var/lib/docker/containers/881c80fe69c85a7347a381885e39826cb1c6d957509b877c0195abccc1a869ab/hostname",
|
132
|
+
"HostsPath": "/var/lib/kubelet/pods/c63bf8b0-74bb-11e6-ab1f-0e245a15209f/etc-hosts",
|
133
|
+
"ShmPath": "/var/lib/docker/containers/881c80fe69c85a7347a381885e39826cb1c6d957509b877c0195abccc1a869ab/shm",
|
134
|
+
"ResolvConfPath": "/var/lib/docker/containers/881c80fe69c85a7347a381885e39826cb1c6d957509b877c0195abccc1a869ab/resolv.conf",
|
135
|
+
"SeccompProfile": "unconfined"
|
136
|
+
}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
{
|
2
|
+
"State": {
|
3
|
+
"Running": true,
|
4
|
+
"Paused": false,
|
5
|
+
"Restarting": false,
|
6
|
+
"OOMKilled": false,
|
7
|
+
"RemovalInProgress": false,
|
8
|
+
"Dead": false,
|
9
|
+
"Pid": 1427,
|
10
|
+
"ExitCode": 0,
|
11
|
+
"Error": "",
|
12
|
+
"StartedAt": "2016-09-06T17:26:52.477792167Z",
|
13
|
+
"FinishedAt": "0001-01-01T00:00:00Z"
|
14
|
+
},
|
15
|
+
"ID": "10975136c25e7f387182957dc38c9d0599ef126321b3c64fba71869c8dfe5701",
|
16
|
+
"Created": "2016-09-06T17:26:52.162175949Z",
|
17
|
+
"Path": "/pause",
|
18
|
+
"Args": [],
|
19
|
+
"Config": {
|
20
|
+
"Hostname": "ip-10-11-1-200",
|
21
|
+
"Domainname": "ec2.internal",
|
22
|
+
"User": "",
|
23
|
+
"AttachStdin": false,
|
24
|
+
"AttachStdout": false,
|
25
|
+
"AttachStderr": false,
|
26
|
+
"Tty": false,
|
27
|
+
"OpenStdin": false,
|
28
|
+
"StdinOnce": false,
|
29
|
+
"Env": null,
|
30
|
+
"Cmd": null,
|
31
|
+
"Image": "gcr.io/google_containers/pause-amd64:3.0",
|
32
|
+
"Volumes": null,
|
33
|
+
"WorkingDir": "",
|
34
|
+
"Entrypoint": [
|
35
|
+
"/pause"
|
36
|
+
],
|
37
|
+
"OnBuild": null,
|
38
|
+
"Labels": {
|
39
|
+
"io.kubernetes.container.hash": "d8dbe16c",
|
40
|
+
"io.kubernetes.container.name": "POD",
|
41
|
+
"io.kubernetes.container.restartCount": "0",
|
42
|
+
"io.kubernetes.container.terminationMessagePath": "",
|
43
|
+
"io.kubernetes.pod.name": "kube-proxy-ip-10-11-1-200.ec2.internal",
|
44
|
+
"io.kubernetes.pod.namespace": "kube-system",
|
45
|
+
"io.kubernetes.pod.terminationGracePeriod": "30",
|
46
|
+
"io.kubernetes.pod.uid": "acce19281f740ab9fd098b277e22de6a"
|
47
|
+
}
|
48
|
+
},
|
49
|
+
"Image": "sha256:99e59f495ffaa222bfeb67580213e8c28c1e885f1d245ab2bbe3b1b1ec3bd0b2",
|
50
|
+
"NetworkSettings": {
|
51
|
+
"Bridge": "",
|
52
|
+
"SandboxID": "d5af54bf063e36bb43702190bea8db61a1ed1583480a89330317c20aee672b00",
|
53
|
+
"HairpinMode": false,
|
54
|
+
"LinkLocalIPv6Address": "",
|
55
|
+
"LinkLocalIPv6PrefixLen": 0,
|
56
|
+
"Networks": {
|
57
|
+
"host": {
|
58
|
+
"IPAMConfig": null,
|
59
|
+
"Links": null,
|
60
|
+
"Aliases": null,
|
61
|
+
"NetworkID": "d06b2c14dba4dd35a5f728f9c85436f2115e5a564f4d2ef721ad35ddba75c367",
|
62
|
+
"EndpointID": "692baebff8446d78ba9daeb0613d1ccd1b538dc67652cbfb945169141e380540",
|
63
|
+
"Gateway": "",
|
64
|
+
"IPAddress": "",
|
65
|
+
"IPPrefixLen": 0,
|
66
|
+
"IPv6Gateway": "",
|
67
|
+
"GlobalIPv6Address": "",
|
68
|
+
"GlobalIPv6PrefixLen": 0,
|
69
|
+
"MacAddress": ""
|
70
|
+
}
|
71
|
+
},
|
72
|
+
"Ports": {},
|
73
|
+
"SandboxKey": "/var/run/docker/netns/default",
|
74
|
+
"SecondaryIPAddresses": null,
|
75
|
+
"SecondaryIPv6Addresses": null,
|
76
|
+
"IsAnonymousEndpoint": false
|
77
|
+
},
|
78
|
+
"LogPath": "/var/lib/docker/containers/10975136c25e7f387182957dc38c9d0599ef126321b3c64fba71869c8dfe5701/10975136c25e7f387182957dc38c9d0599ef126321b3c64fba71869c8dfe5701-json.log",
|
79
|
+
"Name": "/k8s_POD.d8dbe16c_kube-proxy-ip-10-11-1-200.ec2.internal_kube-system_acce19281f740ab9fd098b277e22de6a_b19e3661",
|
80
|
+
"Driver": "overlay",
|
81
|
+
"MountLabel": "system_u:object_r:svirt_lxc_file_t:s0:c137,c738",
|
82
|
+
"ProcessLabel": "system_u:system_r:svirt_lxc_net_t:s0:c137,c738",
|
83
|
+
"RestartCount": 0,
|
84
|
+
"HasBeenStartedBefore": true,
|
85
|
+
"HasBeenManuallyStopped": false,
|
86
|
+
"MountPoints": {},
|
87
|
+
"AppArmorProfile": "",
|
88
|
+
"HostnamePath": "/var/lib/docker/containers/10975136c25e7f387182957dc38c9d0599ef126321b3c64fba71869c8dfe5701/hostname",
|
89
|
+
"HostsPath": "/var/lib/docker/containers/10975136c25e7f387182957dc38c9d0599ef126321b3c64fba71869c8dfe5701/hosts",
|
90
|
+
"ShmPath": "/var/lib/docker/containers/10975136c25e7f387182957dc38c9d0599ef126321b3c64fba71869c8dfe5701/shm",
|
91
|
+
"ResolvConfPath": "/var/lib/docker/containers/10975136c25e7f387182957dc38c9d0599ef126321b3c64fba71869c8dfe5701/resolv.conf",
|
92
|
+
"SeccompProfile": "unconfined"
|
93
|
+
}
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "logstash/devutils/rspec/spec_helper"
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: logstash-filter-k8s
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Saso Matejina
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: 2.0.0
|
19
|
+
- - "<"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
22
|
+
name: logstash-core
|
23
|
+
prerelease: false
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.0.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.0.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - "~>"
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
name: logstash-devutils
|
40
|
+
prerelease: false
|
41
|
+
type: :development
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program
|
48
|
+
email: saso@checkr.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- Gemfile
|
54
|
+
- LICENSE
|
55
|
+
- README.md
|
56
|
+
- lib/logstash/filters/kubernetes.rb
|
57
|
+
- logstash-filter-k8s.gemspec
|
58
|
+
- spec/filters/kubernetes_spec.rb
|
59
|
+
- spec/fixtures/container-json.log
|
60
|
+
- spec/fixtures/pod-json.log
|
61
|
+
- spec/spec_helper.rb
|
62
|
+
homepage: https://github.com/checkr/logstash-filter-k8s
|
63
|
+
licenses:
|
64
|
+
- MIT
|
65
|
+
metadata:
|
66
|
+
logstash_plugin: 'true'
|
67
|
+
logstash_group: filter
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 2.6.4
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: This filter extracts useful kubernetes information from kubelet logfile symlinks.
|
88
|
+
test_files:
|
89
|
+
- spec/filters/kubernetes_spec.rb
|
90
|
+
- spec/fixtures/container-json.log
|
91
|
+
- spec/fixtures/pod-json.log
|
92
|
+
- spec/spec_helper.rb
|