LinkedNestBlog

Fluentd For Azure Storage

by Dev Jinwon

Library Installation Command For Azure Storage

[xxxxxxxx@api00 ~]$ sudo /usr/sbin/td-agent-gem install fluent-plugin-azurestorage

Printed Installation Log

[sudo] password for xxxxxxxx:
Fetching: uuidtools-2.2.0.gem (100%)
Successfully installed uuidtools-2.2.0
Fetching: systemu-2.6.5.gem (100%)
Successfully installed systemu-2.6.5
Fetching: multipart-post-2.1.1.gem (100%)
Successfully installed multipart-post-2.1.1
Fetching: faraday-0.17.5.gem (100%)
Successfully installed faraday-0.17.5
Fetching: faraday_middleware-0.14.0.gem (100%)
Successfully installed faraday_middleware-0.14.0
Fetching: azure-core-0.1.15.gem (100%)
Successfully installed azure-core-0.1.15
Fetching: azure-0.7.7.gem (100%)
Successfully installed azure-0.7.7
Fetching: fluent-plugin-azurestorage-0.1.0.gem (100%)
Successfully installed fluent-plugin-azurestorage-0.1.0
Parsing documentation for uuidtools-2.2.0
Installing ri documentation for uuidtools-2.2.0
Parsing documentation for systemu-2.6.5
Installing ri documentation for systemu-2.6.5
Parsing documentation for multipart-post-2.1.1
Installing ri documentation for multipart-post-2.1.1
Parsing documentation for faraday-0.17.5
Installing ri documentation for faraday-0.17.5
Parsing documentation for faraday_middleware-0.14.0
Installing ri documentation for faraday_middleware-0.14.0
Parsing documentation for azure-core-0.1.15
Installing ri documentation for azure-core-0.1.15
Parsing documentation for azure-0.7.7
Installing ri documentation for azure-0.7.7
Parsing documentation for fluent-plugin-azurestorage-0.1.0
Installing ri documentation for fluent-plugin-azurestorage-0.1.0
Done installing documentation for uuidtools, systemu, multipart-post, faraday, faraday_middleware, azure-core, azure, fluent-plugin-azurestorage after 3 seconds
8 gems installed
[xxxxxxxx@api00 ~]$ sudo td-agent-gem install fluent-plugin-newrelic
Successfully installed fluent-plugin-newrelic-1.2.1
Parsing documentation for fluent-plugin-newrelic-1.2.1
Done installing documentation for fluent-plugin-newrelic after 0 seconds
1 gem installed

Configuration For Azure Storage

<source>
  @type tail
  @log_level warn
  <parse>
    @type none
  </parse>
  path /var/log/happycode/api-res/*/*/%Y-%m-%d.txt
  pos_file /tmp/td-agent/log_live_api_res.pos
  tag live.game.backend.res
</source>

<match live.game.backend.res>
  @type azurestorage

  azure_storage_account    htrgplatformdiag
  azure_storage_access_key tGt5bYkzbP0vRFPUwKRjqCp06VfEIq3t96HSqVj4/RUcxYc/8P0s1E7/jAHp6yeMf5THJkteY/iidS4BN4ocjg==
  azure_container          platformlogs
  azure_storage_type       blob
  store_as                 gzip
  auto_create_container    true
  path                     logs/
  azure_object_key_format  %{path}%{time_slice}_%{index}.%{file_extension}
  time_slice_format        %Y%m%d-%H
  # if you want to use ${tag} or %Y/%m/%d/ like syntax in path / s3_object_key_format,
  # need to specify tag for ${tag} and time for %Y/%m/%d in <buffer> argument.
  <buffer tag,time>
    @type file
    path /tmp/td-agent/fluent/azurestorage
    timekey 3600 # 1 hour partition
    timekey_wait 10m
    timekey_use_utc true # use utc
  </buffer>
</match>
Fluentd For Azure Storage · LinkedNest Blog