Skip to content

Commit f4fe213

Browse files
author
Yoichi Kawasaki
committed
Fixup test code and add a new documnet
1 parent 262aa2a commit f4fe213

File tree

3 files changed

+95
-7
lines changed

3 files changed

+95
-7
lines changed

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,20 @@
1111
| < 0.3.0 | >= v0.12.0 | >= 1.9 |
1212

1313
## Installation
14+
### Installing gems into system Ruby
1415
```
1516
$ gem install fluent-plugin-azure-loganalytics
1617
```
1718

19+
### Installing gems into td-agent’s Ruby
20+
If you installed td-agent and want to add this custom plugins, use td-agent-gem to install as td-agent has own Ruby so you should install gems into td-agent’s Ruby, not system Ruby:
21+
22+
```
23+
$ /usr/sbin/td-agent-gem install fluent-plugin-azure-loganalytics
24+
```
25+
Please see also [I installed td-agent and want to add custom plugins. How do I do it?](https://docs.fluentd.org/v0.12/articles/faq#i-installed-td-agent-and-want-to-add-custom-plugins.-how-do-i-do-it?)
26+
27+
1828
## Configuration
1929

2030
### Azure Log Analytics
@@ -119,7 +129,7 @@ The output record for sample input can be seen at Log Analytics portal like this
119129

120130

121131
## Tests
122-
### Running test code
132+
### Running test code (using System rake)
123133
```
124134
$ git clone https://github.com/yokawasa/fluent-plugin-azure-loganalytics.git
125135
$ cd fluent-plugin-azure-loganalytics
@@ -131,6 +141,18 @@ $ vi test/plugin/test_azure_loganalytics.rb
131141
$ rake test
132142
```
133143

144+
### Running test code (using td-agent's rake)
145+
```
146+
$ git clone https://github.com/yokawasa/fluent-plugin-azure-loganalytics.git
147+
$ cd fluent-plugin-azure-loganalytics
148+
149+
# edit CONFIG params of test/plugin/test_azure_loganalytics.rb
150+
$ vi test/plugin/test_azure_loganalytics.rb
151+
152+
# run test
153+
$ /opt/td-agent/embedded/bin/rake test
154+
```
155+
134156
### Creating package, running and testing locally
135157
```
136158
$ rake build
@@ -148,9 +170,9 @@ $ ab -n 5 -c 2 http://localhost/test/foo.html
148170

149171
## Links
150172

151-
* http://yokawasa.github.io/fluent-plugin-azure-loganalytics
152173
* https://rubygems.org/gems/fluent-plugin-azure-loganalytics
153174
* https://rubygems.org/gems/azure-loganalytics-datacollector-api
175+
* [How to install td-agent and luent-plugin-azure-loganalytics plugin on RHEL](docs/install-tdagent-and-the-plugin-on-rhel.md)
154176

155177
## Contributing
156178

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# How to install td-agent and luent-plugin-azure-loganalytics plugin on RHEL
2+
3+
This is a quick installation procedure of td-agent and the custom plugin (fluent-plugin-azure-loganalytics) on Red Hat Enterprise Linux (7.4)
4+
5+
$ cat /etc/os-release
6+
```
7+
NAME="Red Hat Enterprise Linux Server"
8+
VERSION="7.4 (Maipo)"
9+
ID="rhel"
10+
ID_LIKE="fedora"
11+
VARIANT="Server"
12+
VARIANT_ID="server"
13+
VERSION_ID="7.4"
14+
PRETTY_NAME="Red Hat Enterprise Linux Server 7.4 (Maipo)"
15+
ANSI_COLOR="0;31"
16+
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.4:GA:server"
17+
HOME_URL="https://www.redhat.com/"
18+
BUG_REPORT_URL="https://bugzilla.redhat.com/"
19+
20+
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
21+
REDHAT_BUGZILLA_PRODUCT_VERSION=7.4
22+
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
23+
REDHAT_SUPPORT_PRODUCT_VERSION="7.4"
24+
```
25+
26+
## 0. prerequisites (for Redhat/Centos)
27+
Install GCC and Development Tools on a CentOS / RHEL 7 server
28+
```
29+
$ suod yum group install "Development Tools"
30+
```
31+
32+
## 1. Install td-agent (fluentd)
33+
34+
Following the fluentd official page, install like this:
35+
https://docs.fluentd.org/v0.12/articles/install-by-rpm
36+
```
37+
$ curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent2.sh | sh
38+
39+
$ td-agent --version
40+
td-agent 0.12.40
41+
```
42+
43+
## 2. Launching Daemon
44+
```
45+
$ sudo /etc/init.d/td-agent start
46+
$ sudo /etc/init.d/td-agent status
47+
```
48+
## 3. Post Sample Logs via HTTP
49+
By default, /etc/td-agent/td-agent.conf is configured to take logs from HTTP and route them to stdout (/var/log/td-agent/td-agent.log). You can post sample log records using the curl command.
50+
51+
```
52+
$ curl -X POST -d 'json={"json":"message"}' http://localhost:8888/debug.test
53+
54+
# Checking log (/var/log/td-agent/td-agent.log) and see if the log is written
55+
$ cat /var/log/td-agent/td-agent.log
56+
```
57+
58+
## 4. Install the custom plugin
59+
```
60+
$ sudo /usr/sbin/td-agent-gem install fluent-plugin-azure-loganalytics
61+
```
62+
63+
## 5. Testing the plugin
64+
```
65+
$ git clone https://github.com/yokawasa/fluent-plugin-azure-loganalytics.git
66+
$ cd fluent-plugin-azure-loganalytics
67+
$ /opt/td-agent/embedded/bin/rake test
68+
```

test/plugin/test_azure_loganalytics.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ def create_driver(conf = CONFIG)
2222

2323
def test_configure
2424
d = create_driver
25-
assert_equal '<Customer ID aka WorkspaceID String>', d.instance.customer_id
26-
assert_equal '<Primary Key String>', d.instance.shared_key
2725
assert_equal 'ApacheAccessLog', d.instance.log_type
28-
assert_true d.instance.add_time_field
29-
assert_true d.instance.localtime
30-
assert_true d.instance.add_tag_field
26+
assert_equal true, d.instance.add_time_field
27+
assert_equal true, d.instance.localtime
28+
assert_equal true, d.instance.add_tag_field
3129
assert_equal 'tag', d.instance.tag_field_name
3230
end
3331

0 commit comments

Comments
 (0)