You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pipeline/inputs/serial-interface.md
+71-53Lines changed: 71 additions & 53 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,40 +1,47 @@
1
-
# Serial Interface
1
+
# Serial interface
2
2
3
-
The **serial** input plugin, allows to retrieve messages/data from a _Serial_ interface.
3
+
The _Serial_ input plugin lets you retrieve messages and data from a serial interface.
4
4
5
-
## Configuration Parameters
5
+
## Configuration parameters
6
6
7
-
| Key | Description |
8
-
| :--- | :--- |
9
-
| File | Absolute path to the device entry, e.g: /dev/ttyS0 |
10
-
| Bitrate | The bitrate for the communication, e.g: 9600, 38400, 115200, etc |
11
-
| Min\_Bytes | The serial interface will expect at least _Min\_Bytes_ to be available before to process the message \(default: 1\)|
12
-
| Separator | Allows to specify a _separator_ string that's used to determinate when a message ends. |
13
-
| Format | Specify the format of the incoming data stream. The only option available is 'json'. Note that _Format_ and _Separator_ cannot be used at the same time. |
14
-
| Threaded | Indicates whether to run this input in its own [thread](../../administration/multithreading.md#inputs). Default: `false`. |
7
+
This plugin has the following configuration parameters:
15
8
16
-
## Getting Started
9
+
| Key | Description | Default |
10
+
| :--- | :--- | ---------|
11
+
|`File`| Absolute path to the device entry. For example, `/dev/ttyS0`. |_none_|
12
+
|`Bitrate`| The bit rate for the communication. For example: `9600`, `38400`, `115200`. |_none_|
13
+
|`Min_Bytes`| The serial interface expects at least `Min_Bytes` to be available before processing the message. |`1`|
14
+
|`Separator`| Specify a separator string that's used to determinate when a message ends. |_none_|
15
+
|`Format`| Specify the format of the incoming data stream. `Format` and `Separator` can't be used at the same time. |`json` (no other options available) |
16
+
|`Threaded`| Indicates whether to run this input in its own [thread](../../administration/multithreading.md#inputs). |`false`|
17
17
18
-
In order to retrieve messages over the _Serial_ interface, you can run the plugin from the command line or through the configuration file:
18
+
## Get started
19
19
20
-
### Command Line
20
+
To retrieve messages over the Serial interface, you can run the plugin from the command line or through the configuration file:
21
21
22
-
The following example loads the input _serial_ plugin where it set a Bitrate of 9600, listen from the _/dev/tnt0_ interface and use the custom tag _data_ to route the message.
22
+
### Command line
23
23
24
-
```text
25
-
$ fluent-bit -i serial -t data -p File=/dev/tnt0 -p BitRate=9600 -o stdout -m '*'
24
+
The following example loads the input serial plugin where it set a `Bitrate` of `9600`, listens from the `/dev/tnt0` interface and uses the custom tag `data` to route the message.
25
+
26
+
```shell
27
+
fluent-bit -i serial -t data -p File=/dev/tnt0 -p BitRate=9600 -o stdout -m '*'
26
28
```
27
29
28
-
The above interface \(/dev/tnt0\) is an emulation of the serial interface\(more details at bottom\), for demonstrative purposes we will write some message to the other end of the interface, in this case _/dev/tnt1_, e.g:
30
+
The interface (`/dev/tnt0`) is an emulation of the serial interface. Further examples will write some message to the other end of the interface. For example, `/dev/tnt1`.
29
31
30
-
```text
31
-
$ echo 'this is some message' > /dev/tnt1
32
+
```shell
33
+
echo'this is some message'> /dev/tnt1
32
34
```
33
35
34
-
In Fluent Bit you should see an output like this:
36
+
In Fluent Bit you can run the command:
35
37
36
38
```bash
37
-
$ fluent-bit -i serial -t data -p File=/dev/tnt0 -p BitRate=9600 -o stdout -m '*'
39
+
fluent-bit -i serial -t data -p File=/dev/tnt0 -p BitRate=9600 -o stdout -m '*'
40
+
```
41
+
42
+
Which should produce output like:
43
+
44
+
```text
38
45
Fluent Bit v1.x.x
39
46
* Copyright (C) 2019-2020 The Fluent Bit Authors
40
47
* Copyright (C) 2015-2018 Treasure Data
@@ -45,14 +52,23 @@ Fluent Bit v1.x.x
45
52
[0] data: [1463780680, {"msg"=>"this is some message"}]
46
53
```
47
54
48
-
Now using the _Separator_ configuration, we could send multiple messages at once\(run this command after starting Fluent Bit\):
55
+
Using the `Separator` configuration, you can send multiple messages at once.
49
56
50
-
```text
51
-
$ echo 'aaXbbXccXddXee' > /dev/tnt1
57
+
Run this command after starting Fluent Bit:
58
+
59
+
```shell
60
+
echo'aaXbbXccXddXee'> /dev/tnt1
61
+
```
62
+
63
+
Then, run Fluent Bit:
64
+
65
+
```shell
66
+
fluent-bit -i serial -t data -p File=/dev/tnt0 -p BitRate=9600 -p Separator=X -o stdout -m '*'
52
67
```
53
68
69
+
This should produce results similar to the following:
70
+
54
71
```text
55
-
$ fluent-bit -i serial -t data -p File=/dev/tnt0 -p BitRate=9600 -p Separator=X -o stdout -m '*'
56
72
Fluent-Bit v0.8.0
57
73
Copyright (C) Treasure Data
58
74
@@ -63,9 +79,9 @@ Copyright (C) Treasure Data
63
79
[3] data: [1463781902, {"msg"=>"dd"}]
64
80
```
65
81
66
-
### Configuration File
82
+
### Configuration file
67
83
68
-
In your main configuration file append the following _Input_ & _Output_sections:
84
+
In your main configuration file append the following sections:
69
85
70
86
```python
71
87
[INPUT]
@@ -80,43 +96,45 @@ In your main configuration file append the following _Input_ & _Output_ sections
80
96
Match *
81
97
```
82
98
83
-
## Emulating Serial Interface on Linux
99
+
## Emulating a serial interface on Linux
84
100
85
-
The following content is some extra information that will allow you to emulate a serial interface on your Linux system, so you can test this _Serial_ input plugin locally in case you don't have such interface in your computer. The following procedure has been tested on Ubuntu 15.04 running a Linux Kernel 4.0.
101
+
You can emulate a serial interface on your Linux system and test the serial input plugin locally when you don't have an interface in your computer. The following procedure has been tested on Ubuntu 15.04 running a Linux Kernel 4.0.
86
102
87
-
## Build and install the tty0tty module
103
+
###Build and install the `tty0tty` module
88
104
89
-
Download the sources
105
+
1.Download the sources
90
106
91
-
```bash
92
-
$ git clone https://github.com/freemed/tty0tty
93
-
```
107
+
```bash
108
+
git clone https://github.com/freemed/tty0tty
109
+
```
94
110
95
-
Unpack and compile
111
+
1.Unpack and compile
96
112
97
-
```bash
98
-
$cd tty0tty/module
99
-
$ make
100
-
```
113
+
```bash
114
+
cd tty0tty/module
115
+
make
116
+
```
101
117
102
-
Copy the new kernel module into the kernel modules directory
118
+
1.Copy the new kernel module into the kernel modules directory
0 commit comments