Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
fluent-plugin-gcloud-pubsub-custom-compress-batches
Advanced tools
This plugin is forked from https://github.com/mdoi/fluent-plugin-gcloud-pubsub
Google Cloud Pub/Sub Input/Output(BufferedOutput) plugin for Fluentd with google-cloud gem
When using output plugin, you need to grant Pub/Sub Publisher and Pub/Sub Viewer role to IAM.
Also, when using input plugin, you need to grant Pub/Sub Subscriber and Pub/Sub Viewer role to IAM.
fluent-plugin-gcloud-pubsub-custom | fluentd | ruby |
---|---|---|
>= 1.0.0 | >= v0.14.0 | >= 2.1 |
< 1.0.0 | >= v0.12.0 | >= 1.9 |
Install by gem:
$ gem install fluent-plugin-gcloud-pubsub-custom
Caution
This plugin doesn't work in td-agent.
Please use in Fluentd installed by gem.
Use gcloud_pubsub
output plugin.
<match example.publish>
@type gcloud_pubsub
project <YOUR PROJECT>
key <YOUR KEY>
topic <YOUR TOPIC>
autocreate_topic false
max_messages 1000
max_total_size 9800000
max_message_size 4000000
compress_batches false
<buffer>
@type memory
flush_interval 1s
</buffer>
<format>
@type json
</format>
</match>
project
(optional)
GCLOUD_PROJECT
.key
(optional)
GCLOUD_KEYFILE
.topic
(required)
autocreate_topic
(optional, default: false
)
true
, specified topic will be created when it doesn't exist.max_messages
(optional, default: 1000
)
max_total_size
(optional, default: 9800000
= 9.8MB
)
max_message_size
(optional, default: 4000000
= 4MB
)
max_message_size
are not published because Pub/Sub clients cannot receive it.attribute_keys
(optional, default: []
)
metric_prefix
(optional, default: fluentd_output_gcloud_pubsub
)
compress_batches
(optional, default: false
)
true
, messages will be batched and compressed before publication. See message compression for details.Use gcloud_pubsub
input plugin.
<source>
@type gcloud_pubsub
tag example.pull
project <YOUR PROJECT>
key <YOUR KEY>
topic <YOUR TOPIC>
subscription <YOUR SUBSCRIPTION>
max_messages 1000
return_immediately true
pull_interval 0.5
pull_threads 2
parse_error_action exception
enable_rpc true
rpc_bind 0.0.0.0
rpc_port 24680
<parse>
@type json
</parse>
</source>
tag
(required)
tag_key
is specified, tag
is used as tag when record don't have specified key.tag_key
(optional)
project
(optional)
GCLOUD_PROJECT
.key
(optional)
GCLOUD_KEYFILE
.topic
(optional)
subscription
(required)
max_messages
(optional, default: 100
)
return_immediately
(optional, default: true
)
return_immediately
is true
or pulling message is stopped by HTTP RPC, this plugin wait pull_interval
each pull.pull_interval
(optional, default: 5.0
)
pull_threads
(optional, default: 1
)
attribute_keys
(optional, default: []
)
parse_error_action
(optional, default: exception
)
exception
: Raise exception. Messages are not acknowledged.warning
: Only logging as warning.metric_prefix
(optional, default: fluentd_input_gcloud_pubsub
)
enable_rpc
(optional, default: false
)
true
is specified, HTTP RPC to stop or start pulling message is enabled.rpc_bind
(optional, default: 0.0.0.0
)
rpc_port
(optional, default: 24680
)
The compress_batches
option can be used to enable the compression of messages
before publication to Pub/Sub.
This works by collecting the buffered messages, taking up to max_total_size
or
max_message_size
input records, then compressing them with Zlib (i.e.
gzip/Deflate) before publishing them as a single message to the Pub/Sub topic.
When transporting large volumes of records via Pub/Sub, e.g. multiple Terabytes per month, this can lead to significant cost savings, as typically the CPU time required to compress the messages will be minimal in comparison to the Pub/Sub costs.
The compression ratio achievable will vary largely depending on the homogeneity of the input records, but typically will be 50% at the very minimum and often around 80-90%.
In order to achieve good compression, consider the following:
flush_mode immediate
, and keep the flush_interval
value
sufficiently high. Use the Prometheus metrics to determine how many records
are being published per message.max_messages
and max_message_size
values high (the defaults are
optimal).gcloud_pubsub
output, use multiple outputs (which will each have
their own buffer) through tagging or labelling.The receiving end must be able to decode these compressed batches of messages,
which it can determine via an attribute set on the Pub/Sub message. The
gcloud_pubsub
input plugin will do this transparently, decompressing any
messages which contain a batch of records and normally processing any messages
which represent just a single record.
Therefore, as long as all of the receivers are updated with support for
compressed batches first, it's then possible to gradually roll out this feature.
The input and output plugins expose several metrics in order to monitor performance:
fluentd_output_gcloud_pubsub_compression_enabled
fluentd_output_gcloud_pubsub_messages_published_per_batch
fluentd_output_gcloud_pubsub_messages_published_bytes
fluentd_output_gcloud_pubsub_messages_compression_duration_seconds
fluentd_output_gcloud_pubsub_messages_compressed_size_per_original_size_ratio
fluentd_input_gcloud_pubsub_pull_errors_total
retryable
label)fluentd_input_gcloud_pubsub_messages_pulled
fluentd_input_gcloud_pubsub_messages_pulled_bytes
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)tag
attribute in output plugin and use tag
attribute as tag in input plugin.FAQs
Unknown package
We found that fluent-plugin-gcloud-pubsub-custom-compress-batches demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.