Serial Interface
In order to retrieve messages over the Serial interface, you can run the plugin from the command line or through the configuration file:
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.
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:
$ fluent-bit -i serial -t data -p File=/dev/tnt0 -p BitRate=9600 -o stdout -m '*'
Fluent-Bit v0.8.0
Copyright (C) Treasure Data
[2016/05/20 15:44:39] [ info] starting engine
[0] data: [1463780680, {"msg"=>"this is some message"}]
Now using the Separator configuration, we could send multiple messages at once (run this command after starting Fluent Bit):
$ echo 'aaXbbXccXddXee' > /dev/tnt1
Configuration File
In your main configuration file append the following Input & Output sections:
[INPUT]
Tag data
File /dev/tnt0
BitRate 9600
Separator X
Name stdout
Match *
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.
Unpack and compile
$ cd tty0tty/module
$ make
Copy the new kernel module into the kernel modules directory
Load the module
$ sudo depmod
$ sudo modprobe tty0tty
$ sudo chmod 666 /dev/tnt*
When the module is loaded, it will interconnect the following virtual interfaces:
/dev/tnt0 <=> /dev/tnt1
/dev/tnt2 <=> /dev/tnt3