fluentd-docs icon indicating copy to clipboard operation
fluentd-docs copied to clipboard

can't understand Parameter:deep_copy in Plugin:out_copy

Open LmYjQ opened this issue 7 years ago • 1 comments

I know the meaning of deep copy. but what does it mean in this scenario? For example, I have two output as it is in the documentation:

<match myevent.file_and_mongo>
  @type copy
  <store>
    @type file
    path /var/log/fluent/myapp
    time_slice_format %Y%m%d
    time_slice_wait 10m
    time_format %Y%m%dT%H%M%S%z
    compress gzip
    utc
  </store>
  <store>
    @type mongo
    host fluentd
    port 27017
    database fluentd
    collection test
  </store>
</match>

If I had my filepath in localhost, and mongo in another host, is it a " inherent deep copy" which I could ignore the deep_copy parameter?

LmYjQ avatar May 02 '17 09:05 LmYjQ

When you use deep_copy parameter, out_copy will uses deep copy behavior on each record. By default, out_copy uses shallow copy behavior which will be lower memory consumption but references "same instance or variable".

If you want to manipulate for each "copied record" after out_copy pipeline, you must use deep_copy parameter. ref: https://www.cs.utexas.edu/~scottm/cs307/handouts/deepCopying.htm

cosmo0920 avatar Jan 04 '18 08:01 cosmo0920