fluent-plugin-scribe 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -0
- data/README.rdoc +50 -0
- data/Rakefile +65 -0
- data/VERSION +1 -0
- data/bin/fluent-scribe-remote +30 -0
- data/example.conf +11 -0
- data/fluent-plugin-scribe.gemspec +45 -0
- data/lib/fluent/plugin/in_scribe.rb +123 -0
- data/lib/fluent/plugin/thrift/facebook_service.rb +700 -0
- data/lib/fluent/plugin/thrift/fb303.thrift +112 -0
- data/lib/fluent/plugin/thrift/fb303_constants.rb +8 -0
- data/lib/fluent/plugin/thrift/fb303_types.rb +18 -0
- data/lib/fluent/plugin/thrift/scribe.rb +82 -0
- data/lib/fluent/plugin/thrift/scribe.thrift +41 -0
- data/lib/fluent/plugin/thrift/scribe_constants.rb +8 -0
- data/lib/fluent/plugin/thrift/scribe_types.rb +34 -0
- metadata +85 -0
@@ -0,0 +1,112 @@
|
|
1
|
+
/*
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
|
20
|
+
/**
|
21
|
+
* fb303.thrift
|
22
|
+
*/
|
23
|
+
|
24
|
+
namespace java com.facebook.fb303
|
25
|
+
namespace cpp facebook.fb303
|
26
|
+
namespace perl Facebook.FB303
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Common status reporting mechanism across all services
|
30
|
+
*/
|
31
|
+
enum fb_status {
|
32
|
+
DEAD = 0,
|
33
|
+
STARTING = 1,
|
34
|
+
ALIVE = 2,
|
35
|
+
STOPPING = 3,
|
36
|
+
STOPPED = 4,
|
37
|
+
WARNING = 5,
|
38
|
+
}
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Standard base service
|
42
|
+
*/
|
43
|
+
service FacebookService {
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Returns a descriptive name of the service
|
47
|
+
*/
|
48
|
+
string getName(),
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Returns the version of the service
|
52
|
+
*/
|
53
|
+
string getVersion(),
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Gets the status of this service
|
57
|
+
*/
|
58
|
+
fb_status getStatus(),
|
59
|
+
|
60
|
+
/**
|
61
|
+
* User friendly description of status, such as why the service is in
|
62
|
+
* the dead or warning state, or what is being started or stopped.
|
63
|
+
*/
|
64
|
+
string getStatusDetails(),
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Gets the counters for this service
|
68
|
+
*/
|
69
|
+
map<string, i64> getCounters(),
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Gets the value of a single counter
|
73
|
+
*/
|
74
|
+
i64 getCounter(1: string key),
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Sets an option
|
78
|
+
*/
|
79
|
+
void setOption(1: string key, 2: string value),
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Gets an option
|
83
|
+
*/
|
84
|
+
string getOption(1: string key),
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Gets all options
|
88
|
+
*/
|
89
|
+
map<string, string> getOptions(),
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Returns a CPU profile over the given time interval (client and server
|
93
|
+
* must agree on the profile format).
|
94
|
+
*/
|
95
|
+
string getCpuProfile(1: i32 profileDurationInSec),
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Returns the unix time that the server has been running since
|
99
|
+
*/
|
100
|
+
i64 aliveSince(),
|
101
|
+
|
102
|
+
/**
|
103
|
+
* Tell the server to reload its configuration, reopen log files, etc
|
104
|
+
*/
|
105
|
+
oneway void reinitialize(),
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Suggest a shutdown to the server
|
109
|
+
*/
|
110
|
+
oneway void shutdown(),
|
111
|
+
|
112
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
|
8
|
+
module Fb_status
|
9
|
+
DEAD = 0
|
10
|
+
STARTING = 1
|
11
|
+
ALIVE = 2
|
12
|
+
STOPPING = 3
|
13
|
+
STOPPED = 4
|
14
|
+
WARNING = 5
|
15
|
+
VALUE_MAP = {0 => "DEAD", 1 => "STARTING", 2 => "ALIVE", 3 => "STOPPING", 4 => "STOPPED", 5 => "WARNING"}
|
16
|
+
VALID_VALUES = Set.new([DEAD, STARTING, ALIVE, STOPPING, STOPPED, WARNING]).freeze
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
require 'facebook_service'
|
9
|
+
require 'scribe_types'
|
10
|
+
|
11
|
+
module Scribe
|
12
|
+
class Client < FacebookService::Client
|
13
|
+
include ::Thrift::Client
|
14
|
+
|
15
|
+
def Log(messages)
|
16
|
+
send_Log(messages)
|
17
|
+
return recv_Log()
|
18
|
+
end
|
19
|
+
|
20
|
+
def send_Log(messages)
|
21
|
+
send_message('Log', Log_args, :messages => messages)
|
22
|
+
end
|
23
|
+
|
24
|
+
def recv_Log()
|
25
|
+
result = receive_message(Log_result)
|
26
|
+
return result.success unless result.success.nil?
|
27
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'Log failed: unknown result')
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
class Processor < FacebookService::Processor
|
33
|
+
include ::Thrift::Processor
|
34
|
+
|
35
|
+
def process_Log(seqid, iprot, oprot)
|
36
|
+
args = read_args(iprot, Log_args)
|
37
|
+
result = Log_result.new()
|
38
|
+
result.success = @handler.Log(args.messages)
|
39
|
+
write_result(result, oprot, 'Log', seqid)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
# HELPER FUNCTIONS AND STRUCTURES
|
45
|
+
|
46
|
+
class Log_args
|
47
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
48
|
+
MESSAGES = 1
|
49
|
+
|
50
|
+
FIELDS = {
|
51
|
+
MESSAGES => {:type => ::Thrift::Types::LIST, :name => 'messages', :element => {:type => ::Thrift::Types::STRUCT, :class => LogEntry}}
|
52
|
+
}
|
53
|
+
|
54
|
+
def struct_fields; FIELDS; end
|
55
|
+
|
56
|
+
def validate
|
57
|
+
end
|
58
|
+
|
59
|
+
::Thrift::Struct.generate_accessors self
|
60
|
+
end
|
61
|
+
|
62
|
+
class Log_result
|
63
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
64
|
+
SUCCESS = 0
|
65
|
+
|
66
|
+
FIELDS = {
|
67
|
+
SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success', :enum_class => ResultCode}
|
68
|
+
}
|
69
|
+
|
70
|
+
def struct_fields; FIELDS; end
|
71
|
+
|
72
|
+
def validate
|
73
|
+
unless @success.nil? || ResultCode::VALID_VALUES.include?(@success)
|
74
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field success!')
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
::Thrift::Struct.generate_accessors self
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/local/bin/thrift --gen cpp:pure_enums --gen php
|
2
|
+
|
3
|
+
## Copyright (c) 2007-2008 Facebook
|
4
|
+
##
|
5
|
+
## Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
## you may not use this file except in compliance with the License.
|
7
|
+
## You may obtain a copy of the License at
|
8
|
+
##
|
9
|
+
## http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
##
|
11
|
+
## Unless required by applicable law or agreed to in writing, software
|
12
|
+
## distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
## See the License for the specific language governing permissions and
|
15
|
+
## limitations under the License.
|
16
|
+
##
|
17
|
+
## See accompanying file LICENSE or visit the Scribe site at:
|
18
|
+
## http://developers.facebook.com/scribe/
|
19
|
+
|
20
|
+
include "fb303.thrift"
|
21
|
+
|
22
|
+
namespace cpp scribe.thrift
|
23
|
+
namespace java scribe.thrift
|
24
|
+
namespace perl Scribe.Thrift
|
25
|
+
|
26
|
+
enum ResultCode
|
27
|
+
{
|
28
|
+
OK,
|
29
|
+
TRY_LATER
|
30
|
+
}
|
31
|
+
|
32
|
+
struct LogEntry
|
33
|
+
{
|
34
|
+
1: string category,
|
35
|
+
2: string message
|
36
|
+
}
|
37
|
+
|
38
|
+
service scribe extends fb303.FacebookService
|
39
|
+
{
|
40
|
+
ResultCode Log(1: list<LogEntry> messages);
|
41
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'fb303_types'
|
8
|
+
|
9
|
+
|
10
|
+
module ResultCode
|
11
|
+
OK = 0
|
12
|
+
TRY_LATER = 1
|
13
|
+
VALUE_MAP = {0 => "OK", 1 => "TRY_LATER"}
|
14
|
+
VALID_VALUES = Set.new([OK, TRY_LATER]).freeze
|
15
|
+
end
|
16
|
+
|
17
|
+
class LogEntry
|
18
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
19
|
+
CATEGORY = 1
|
20
|
+
MESSAGE = 2
|
21
|
+
|
22
|
+
FIELDS = {
|
23
|
+
CATEGORY => {:type => ::Thrift::Types::STRING, :name => 'category'},
|
24
|
+
MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
|
25
|
+
}
|
26
|
+
|
27
|
+
def struct_fields; FIELDS; end
|
28
|
+
|
29
|
+
def validate
|
30
|
+
end
|
31
|
+
|
32
|
+
::Thrift::Struct.generate_accessors self
|
33
|
+
end
|
34
|
+
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-scribe
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.7
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Kazuki Ohta
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-09-05 00:00:00.000000000 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: fluent
|
17
|
+
requirement: &2157481220 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.9.7
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2157481220
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: thrift
|
28
|
+
requirement: &2157480620 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.7.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *2157480620
|
37
|
+
description:
|
38
|
+
email:
|
39
|
+
executables: []
|
40
|
+
extensions: []
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README.rdoc
|
43
|
+
files:
|
44
|
+
- AUTHORS
|
45
|
+
- Rakefile
|
46
|
+
- VERSION
|
47
|
+
- bin/fluent-scribe-remote
|
48
|
+
- example.conf
|
49
|
+
- fluent-plugin-scribe.gemspec
|
50
|
+
- lib/fluent/plugin/in_scribe.rb
|
51
|
+
- lib/fluent/plugin/thrift/facebook_service.rb
|
52
|
+
- lib/fluent/plugin/thrift/fb303.thrift
|
53
|
+
- lib/fluent/plugin/thrift/fb303_constants.rb
|
54
|
+
- lib/fluent/plugin/thrift/fb303_types.rb
|
55
|
+
- lib/fluent/plugin/thrift/scribe.rb
|
56
|
+
- lib/fluent/plugin/thrift/scribe.thrift
|
57
|
+
- lib/fluent/plugin/thrift/scribe_constants.rb
|
58
|
+
- lib/fluent/plugin/thrift/scribe_types.rb
|
59
|
+
- README.rdoc
|
60
|
+
has_rdoc: true
|
61
|
+
homepage:
|
62
|
+
licenses: []
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 1.6.2
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: Scribe plugin for Fluent event collector
|
85
|
+
test_files: []
|