|
2 | 2 |
|
3 | 3 | > A CSV component for the [elastic.io platform](http://www.elastic.io "elastic.io platform").
|
4 | 4 |
|
5 |
| -This is an open source component to work with [CSV](http://en.wikipedia.org/wiki/Comma-separated_values) files in your integration flow and is developed specifically to run on [elastic.io platform](http://www.elastic.io "elastic.io platform"). You can clone it and change it as you wish. However, **if you plan to deploy it into [elastic.io platform](http://www.elastic.io "elastic.io platform") you must follow sets of instructions to succeed**. |
| 5 | +This is an open source component to work with |
| 6 | +[CSV](http://en.wikipedia.org/wiki/Comma-separated_values) files in your |
| 7 | +integration flow and is developed specifically to run on [elastic.io |
| 8 | +platform](http://www.elastic.io "elastic.io platform"). You can clone it and |
| 9 | +change it as you wish. However, **if you plan to deploy it into [elastic.io |
| 10 | +platform](http://www.elastic.io "elastic.io platform") you must follow sets of |
| 11 | +instructions to succeed**. |
6 | 12 |
|
7 |
| -> **PLEASE NOTE:** This is a working component for **CSV** files, however, it may not be suitable for every use case. Not all functionalities are included in this component template. **It is your responsibility to add and modify this component to suit your integration needs.** |
| 13 | +> **PLEASE NOTE:** This is a working component for **CSV** files, however, it |
| 14 | +may not be suitable for every use case. Not all functionality is included in |
| 15 | +this component template. **It is your responsibility to add and modify this |
| 16 | +component to suit your integration needs.** |
8 | 17 |
|
9 | 18 | ## Before you Begin
|
10 | 19 |
|
11 |
| -Before you can deploy any code into our system **you must be a registered elastic.io platform user**. Please see our home page at [http://www.elastic.io](http://www.elastic.io) to learn how. |
| 20 | +Before you can deploy any code into our system **you must be a registered |
| 21 | +elastic.io platform user**. Please see our home page at |
| 22 | +[http://www.elastic.io](http://www.elastic.io) to learn how. |
12 | 23 |
|
13 | 24 | > Any attempt to deploy a code into our platform without a registration would fail.
|
14 | 25 |
|
15 |
| -After the registration and opening of the account you must **[upload your SSH Key](http://docs.elastic.io/docs/ssh-key)** into our platform. |
| 26 | +After the registration and opening of the account you must **[upload your SSH |
| 27 | +Key](http://docs.elastic.io/docs/ssh-key)** into our platform. |
16 | 28 |
|
17 |
| -> If you fail to upload you SSH Key you will get **permission denied** error during the deployment. |
| 29 | +> If you fail to upload you SSH Key you will get **permission denied** error |
| 30 | +during the deployment. |
18 | 31 |
|
19 | 32 | ## Getting Started
|
20 | 33 |
|
21 |
| -After registration and uploading of your SSH Key you can proceed to deploy it into our system. At this stage we suggest you to: |
22 |
| -* [Create a team](http://docs.elastic.io/page/team-management) to work on your new component. This is not required but will be automatically created using random naming by our system so we suggest you name your team accordingly. |
23 |
| -* [Create a repository](http://docs.elastic.io/page/repository-management) where your new component is going to *reside* inside the team that you have just created. For a simplicity you can name your repository **csv-component** or **csv**. |
| 34 | +After registration and uploading of your SSH Key you can proceed to deploy it |
| 35 | +into our system. At this stage we suggest you to: |
| 36 | +* [Create a team](http://docs.elastic.io/page/team-management) to work on your |
| 37 | + new component. This is not required but will be automatically created using |
| 38 | + random naming by our system so we suggest you name your team accordingly. |
| 39 | +* [Create a repository](http://docs.elastic.io/page/repository-management) where |
| 40 | +* your new component is going to *reside* inside the team that you have just |
| 41 | +* created. For a simplicity you can name your repository **csv-component** or |
| 42 | +* **csv**. |
24 | 43 |
|
25 | 44 | ```bash
|
26 | 45 | $ git clone https://github.com/elasticio/csv-component.git csv-component
|
27 | 46 |
|
28 | 47 | $ cd csv-component
|
29 | 48 | ```
|
30 |
| -Now you can edit your version of **csv-component** component and change according to your needs - that is if you know what you are doing. Or you can just ``PUSH``it into our system to see the process in action: |
| 49 | +Now you can edit your version of **csv-component** component and change |
| 50 | +according to your needs - that is if you know what you are doing. Or you can |
| 51 | +just ``PUSH``it into our system to see the process in action: |
31 | 52 |
|
32 | 53 | ```bash
|
33 | 54 | $ git remote add elasticio [email protected]:csv-component.git
|
34 | 55 |
|
35 | 56 | $ git push elasticio master
|
36 | 57 | ```
|
37 |
| -Obviously the naming of your team and repository is entirely up-to you and if you do not put any corresponding naming our system will auto generate it for you but the naming might not entirely correspond to your project requirements. |
| 58 | +Obviously the naming of your team and repository is entirely up-to you and if |
| 59 | +you do not put any corresponding naming our system will auto generate it for you |
| 60 | +but the naming might not entirely correspond to your project requirements. |
| 61 | + |
| 62 | +## Write CSV attachment |
| 63 | + |
| 64 | +Multiple incoming events can be combined into one CSV file with the write CSV |
| 65 | +action. Incoming events will be written into the CSV file until there is a gap |
| 66 | +of more than 10 seconds between events. As part of the component setup, one |
| 67 | +must specify the columns of the CSV file. These columns will be published as |
| 68 | +the header in the first row. For each incoming event, the value for each header |
| 69 | +will be stringified and written as the value for that cell. All other |
| 70 | +properties will be ignored. For example, headers ``foo,bar`` along with the |
| 71 | +following JSON events |
| 72 | + |
| 73 | + {"foo":"myfoo", "bar":"mybar"} |
| 74 | + {"foo":"myfoo", "bar":[1,2]} |
| 75 | + {"bar":"mybar", "baz":"mybaz"} |
| 76 | + |
| 77 | +will produce the following ``.csv`` file: |
| 78 | + |
| 79 | + foo,bar |
| 80 | + myfoo,mybar |
| 81 | + myfoo,"[1,2]" |
| 82 | + ,mybar |
| 83 | + |
| 84 | +Currently no formatting is performed as part of CSV Write. |
0 commit comments