Skip to content

Instantly share code, notes, and snippets.

@komamitsu
Last active September 15, 2015 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save komamitsu/bc1350eaf568a62d9d6f to your computer and use it in GitHub Desktop.
Save komamitsu/bc1350eaf568a62d9d6f to your computer and use it in GitHub Desktop.
Fluentd:PackedForward format
irb(main):018:0> c = TCPSocket.new('127.0.0.1', 24224)
=> #<TCPSocket:fd 12>
irb(main):020:0> c.write(MessagePack.pack(['foo.bar', Time.now.to_i, {:name => 'hoge', :age => 11}]))
=> 30
irb(main):021:0> c.write(MessagePack.pack(['foo.bar', Time.now.to_i, {:name => 'hoge', :age => 11}]))
=> 30
irb(main):022:0> c.write(MessagePack.pack(['foo.bar', Time.now.to_i, {:name => 'hoge', :age => 11}]))
=> 30
[
a7(fixstr:7) : foo.bar
,
db(str:66) :
92(fixarray:2) :
ce(uint32) : 0x55f80b97 => 2015-09-15 21:14:15 +0900
82(fixmap:2) :
a4(fixstr:4) : name
a4(fixstr:4) : hoge
a3(fixstr:3) : age
0b(posfixint) : 11
92(fixarray:2) :
ce(uint32) : 0x55f80b98 => 2015-09-15 21:14:16 +0900
82(fixmap:2) :
a4(fixstr:4) : name
a4(fixstr:4) : hoge
a3(fixstr:3) : age
0b(posfixint) : 11
:
]
irb(main):027:0> c = TCPSocket.new('127.0.0.1', 24225) => #<TCPSocket:fd 15>
irb(main):028:0> c.write(MessagePack.pack(['foo.bar', MessagePack.pack([Time.now.to_i, {:name => 'aaa', :age => 12}]) + MessagePack.pack([Time.now.to_i, {:name => 'bbb', :age => 34}])]))
=> 54
>>>
2015-09-16 00:16:28 +0900 foo.bar: {"name":"aaa","age":12}
2015-09-16 00:16:28 +0900 foo.bar: {"name":"bbb","age":34}
21:15:11.995188 IP 127.0.0.1.57833 > 127.0.0.1.24225: Flags [FP.], seq 2:81, ack 1, win 12759, options [nop,nop,TS val 814009647 ecr 814009647], length 79
0x0000: 4500 0083 8b10 4000 4006 0000 7f00 0001 E.....@.@.......
0x0010: 7f00 0001 e1e9 5ea1 4780 d8b5 52f0 221c ......^.G...R.".
0x0020: 8019 31d7 fe77 0000 0101 080a 3084 cd2f ..1..w......0../
0x0030: 3084 cd2f a766 6f6f 2e62 6172 db00 0000 0../.foo.bar....
0x0040: 4292 ce55 f80b 9782 a46e 616d 65a4 686f B..U.....name.ho
0x0050: 6765 a361 6765 0b92 ce55 f80b 9882 a46e ge.age...U.....n
0x0060: 616d 65a4 686f 6765 a361 6765 0b92 ce55 ame.hoge.age...U
0x0070: f80b 9982 a46e 616d 65a4 686f 6765 a361 .....name.hoge.a
0x0080: 6765 0b ge.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment