fluent-plugin-s3 csv format

304 views
Skip to first unread message

Mani kandan

unread,
Dec 7, 2016, 8:56:54 AM12/7/16
to Fluentd Google Group
I am looking to write logs using a fixed format similar to Tomcat / IIS logs and store them in S3.

Expected format:

Date[tab]Value1[tab]Value2[tab]Value3

Normally, in file output plugins I would be able to do this using csv format (Ref: http://docs.fluentd.org/articles/out_file#format), but here it doesn't seem to be supported.

Can someone please help me out, if there is any workaround for this ? or is this something under development ?

Mr. Fiber

unread,
Dec 7, 2016, 11:47:06 PM12/7/16
to Fluentd Google Group
s3 plugin also has format parameter.


This doesn't work on your environment?


Masahiro

--
You received this message because you are subscribed to the Google Groups "Fluentd Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mani kandan

unread,
Dec 7, 2016, 11:57:54 PM12/7/16
to Fluentd Google Group
The format parameter works, am able to use ltsv, json and single_value, but I am saying that it doesn't support csv at the moment.
To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+u...@googlegroups.com.

Mr. Fiber

unread,
Dec 8, 2016, 12:08:32 AM12/8/16
to Fluentd Google Group
it doesn't support csv at the moment.

Could you write more details of this point?


These built-in formats should work.


To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+unsubscribe@googlegroups.com.

Mani kandan

unread,
Dec 8, 2016, 12:54:50 AM12/8/16
to Fluentd Google Group
Sure, here is the config that I tried to use,

<match app.S3>
  @type s3
  format csv
  delimiter \t
  aws_key_id XXXXXXXX
  aws_sec_key XXXXXXXX
  s3_bucket XXXXX
  s3_region us-east-1
  path Logs/
  buffer_path  /var/log/td-agent/buffer/s3

  time_slice_format %Y%m%d
  time_slice_wait 10s
  utc

  buffer_chunk_limit 256m

</match>

And all log messages started writing in blank / empty lines in the buffer file. But when I used ltsv / json it was working as expected.

Mr. Fiber

unread,
Dec 8, 2016, 1:19:18 AM12/8/16
to Fluentd Google Group
And all log messages started writing in blank / empty lines in the buffer file.

Because you don't specify fields parameter. Here is format example:

JSON: {"f1":"a","f2":"b","f3":"c"}
LTSV: f1:a f2:b f3:c
CSV: a,b,c,

You can see CSV can't contain each field, e.g. f1, in the line unlike LTSV / JSON.
In general, CSV has a header for specifying fields in the head of file.
In streaming, applying header is hard because header is unclear.
So you need to specify fields parameter to point which fields are stored.


To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+unsubscribe@googlegroups.com.

Mani kandan

unread,
Dec 8, 2016, 2:12:38 AM12/8/16
to Fluentd Google Group
Ah Ok, Sorry for the confusion. Is there any other way to just take all fields instead of providing all the fields here ?

Mr. Fiber

unread,
Dec 8, 2016, 2:46:26 AM12/8/16
to Fluentd Google Group
Is there any other way to just take all fields instead of providing all the fields here ?

No way because json doesn't guaratee the order of fields.
So automatic field listing is error prone.


To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+unsubscribe@googlegroups.com.

Mani kandan

unread,
Dec 8, 2016, 4:09:49 AM12/8/16
to Fluentd Google Group
Ok cool, Thanks for helping me out. I also realized that some of the fields are dynamic and so CSV might not make sense for me, will look into other options.
Reply all
Reply to author
Forward
0 new messages