# fluent-plugin-festival tutorial
## Install fluentd
```
gem install fluent-plugin-festival
```
fluentd will be installed automatically.
## Create a sample configuration file
Create a sample configuration file as follows. For sensinact api_type case, you can specify dummy username and password.
For api_type: sensinact
```
% vi fluent.conf
---
---
```
For festival api_type case, You need to change festival_portal_login_name and festival_portal_password to your account information.
For api_type: festival
```
% vi fluent.conf
---
@type stdout
---
```
## Start fluentd with debug mode
Start fluentd with debug mode as follows.
```
fluentd -c fluent.conf -vvv
```
Then, you can confirm the sensor values are output to your console.
You can try the other resources by browsing resources via FESTIVAL portal and change target resource URI to the ones listed in the resource information.
## Store data into Elasticsearch
About installation, please refer the following page.
https://www.elastic.co/downloads/elasticsearch
In the followings, how to store FESTIVAL platform data into Elasticsearch will be shown.
First of all, you need to create mapping in Elasticsearch. An Elasticsearch server is assumed to run in localhost.
```
vi iot_gateway-mapping.json
---
{
"iot_gateway": {
"properties": {
"timestamp": {
"type": "date",
"format": "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
},
"resourceName": {
"type": "keyword"
},
"dataValue": {
"type": "double"
},
"location": {
"type": "geo_point"
}
}
}
}
---
curl -XPUT 'http://localhost:9200/festival'
curl -H "Content-Type: application/json" -XPUT 'http://localhost:9200/festival/iot_gateway/_mapping' -d @iot_gateway-mapping.json
```
For api_type: sensinact
```
% vi fluent.conf
---
---
```
For api_type: festival
```
% vi fluent.conf
---
```