Giter Club home page Giter Club logo

fluent-plugin-webhdfs's Introduction

fluent-plugin-webhdfs

Build Status

Fluentd output plugin to write data into Hadoop HDFS over WebHDFS/HttpFs.

"webhdfs" output plugin formats data into plain text, and store it as files on HDFS. This plugin supports:

  • inject tag and time into record (and output plain text data) using <inject> section
  • format events into plain text by format plugins using <format> section
  • control flushing using <buffer> section

Paths on HDFS can be generated from event timestamp, tag or any other fields in records.

Requirements

fluent-plugin-webhdfs fluentd ruby
>= 1.0.0 >= v0.14.4 >= 2.1
< 1.0.0 < v0.14.0 >= 1.9

Older versions

The versions of 0.x.x of this plugin are for older version of Fluentd (v0.12.x). Old style configuration parameters (using output_data_type, output_include_* or others) are still supported, but are deprecated. Users should use <format> section to control how to format events into plain text.

Configuration

WebHDFSOutput

To store data by time,tag,json (same with '@type file') over WebHDFS:

<match access.**>
  @type webhdfs
  host namenode.your.cluster.local
  port 50070
  path /path/on/hdfs/access.log.%Y%m%d_%H.log
</match>

If you want JSON object only (without time or tag or both on header of lines), use <format> section to specify json formatter:

<match access.**>
  @type webhdfs
  host namenode.your.cluster.local
  port 50070
  path /path/on/hdfs/access.log.%Y%m%d_%H.log
  <format>
    @type json
  </format>
</match>

To specify namenode, namenode is also available:

<match access.**>
  @type     webhdfs
  namenode master.your.cluster.local:50070
  path     /path/on/hdfs/access.log.%Y%m%d_%H.log
</match>

To store data as JSON, including time and tag (using <inject>), over WebHDFS:

<match access.**>
  @type webhdfs
  host namenode.your.cluster.local
  port 50070
  path /path/on/hdfs/access.log.%Y%m%d_%H.log
  <buffer>
    timekey_zone -0700 # to specify timezone used for "path" time placeholder formatting
  </buffer>
  <inject>
    tag_key   tag
    time_key  time
    time_type string
    timezone  -0700
  </inject>
  <format>
    @type json
  </format>
</match>

To store data as JSON, including time as unix time, using path including tag as directory:

<match access.**>
  @type webhdfs
  host namenode.your.cluster.local
  port 50070
  path /path/on/hdfs/${tag}/access.log.%Y%m%d_%H.log
  <buffer time,tag>
    @type   file                    # using file buffer
    path    /var/log/fluentd/buffer # buffer directory path
    timekey 3h           # create a file per 3h
    timekey_use_utc true # time in path are formatted in UTC (default false means localtime)
  </buffer>
  <inject>
    time_key  time
    time_type unixtime
  </inject>
  <format>
    @type json
  </format>
</match>

With username of pseudo authentication:

<match access.**>
  @type webhdfs
  host namenode.your.cluster.local
  port 50070
  path /path/on/hdfs/access.log.%Y%m%d_%H.log
  username hdfsuser
</match>

Store data over HttpFs (instead of WebHDFS):

<match access.**>
  @type webhdfs
  host httpfs.node.your.cluster.local
  port 14000
  path /path/on/hdfs/access.log.%Y%m%d_%H.log
  httpfs true
</match>

With ssl:

<match access.**>
  @type webhdfs
  host namenode.your.cluster.local
  port 50070
  path /path/on/hdfs/access.log.%Y%m%d_%H.log
  ssl true
  ssl_ca_file /path/to/ca_file.pem   # if needed
  ssl_verify_mode peer               # if needed (peer or none)
</match>

Here ssl_verify_mode peer means to verify the server's certificate. You can turn off it by setting ssl_verify_mode none. The default is peer. See net/http and openssl documentation for further details.

With kerberos authentication:

<match access.**>
  @type webhdfs
  host namenode.your.cluster.local
  port 50070
  path /path/on/hdfs/access.log.%Y%m%d_%H.log
  kerberos true
  kerberos_keytab /path/to/keytab # if needed
  renew_kerberos_delegation_token true # if needed
</match>

NOTE: You need to install gssapi gem for kerberos. See https://github.com/kzk/webhdfs#for-kerberos-authentication

If you want to compress data before storing it:

<match access.**>
  @type webhdfs
  host namenode.your.cluster.local
  port 50070
  path /path/on/hdfs/access.log.%Y%m%d_%H
  compress gzip  # or 'bzip2', 'snappy', 'hadoop_snappy', 'lzo_command', 'zstd'
</match>

Note that if you set compress gzip, then the suffix .gz will be added to path (or .bz2, .sz, .snappy, .lzo, .zst). Note that you have to install additional gem for several compress algorithms:

  • snappy: install snappy gem
  • hadoop_snappy: install snappy gem
  • bzip2: install bzip2-ffi gem
  • zstd: install zstandard gem

Note that zstd will require installation of the libzstd native library. See the zstandard-ruby repo for infomration on the required packages for your operating system.

You can also specify compression block size (currently supported only for Snappy codecs):

<match access.**>
  @type webhdfs
  host namenode.your.cluster.local
  port 50070
  path /path/on/hdfs/access.log.%Y%m%d_%H
  compress hadoop_snappy
  block_size 32768
</match>

If you want to explicitly specify file extensions in HDFS (override default compressor extensions):

<match access.**>
  @type webhdfs
  host namenode.your.cluster.local
  port 50070
  path /path/on/hdfs/access.log.%Y%m%d_%H
  compress snappy
  extension ".snappy"
</match>

With this configuration paths in HDFS will be like /path/on/hdfs/access.log.20201003_12.snappy. This one may be useful when (for example) you need to use snappy codec but .sz files are not recognized as snappy files in HDFS.

Namenode HA / Auto retry for WebHDFS known errors

fluent-plugin-webhdfs (v0.2.0 or later) accepts 2 namenodes for Namenode HA (active/standby). Use standby_namenode like this:

<match access.**>
  @type            webhdfs
  namenode         master1.your.cluster.local:50070
  standby_namenode master2.your.cluster.local:50070
  path             /path/on/hdfs/access.log.%Y%m%d_%H.log
</match>

And you can also specify to retry known hdfs errors (such like LeaseExpiredException) automatically. With this configuration, fluentd doesn't write logs for this errors if retry successed.

<match access.**>
  @type              webhdfs
  namenode           master1.your.cluster.local:50070
  path               /path/on/hdfs/access.log.%Y%m%d_%H.log
  retry_known_errors yes
  retry_times        1 # default 1
  retry_interval     1 # [sec] default 1
</match>

Performance notifications

Writing data on HDFS single file from 2 or more fluentd nodes, makes many bad blocks of HDFS. If you want to run 2 or more fluentd nodes with fluent-plugin-webhdfs, you should configure 'path' for each node. To include hostname, #{Socket.gethostname} is available in Fluentd configuration string literals by ruby expression (in "..." strings). This plugin also supports ${uuid} placeholder to include random uuid in paths.

For hostname:

<match access.**>
  @type webhdfs
  host namenode.your.cluster.local
  port 50070
  path "/log/access/%Y%m%d/#{Socket.gethostname}.log" # double quotes needed to expand ruby expression in string
</match>

Or with random filename (to avoid duplicated file name only):

<match access.**>
  @type webhdfs
  host namenode.your.cluster.local
  port 50070
  path /log/access/%Y%m%d/${uuid}.log
</match>

With configurations above, you can handle all of files of /log/access/20120820/* as specified timeslice access logs.

For high load cluster nodes, you can specify timeouts for HTTP requests.

<match access.**>
  @type webhdfs
  namenode master.your.cluster.local:50070
  path /log/access/%Y%m%d/${hostname}.log
  open_timeout 180 # [sec] default: 30
  read_timeout 180 # [sec] default: 60
</match>

For unstable Namenodes

With default configuration, fluent-plugin-webhdfs checks HDFS filesystem status and raise error for inactive NameNodes.

If you were using unstable NameNodes and have wanted to ignore NameNode errors on startup of fluentd, enable ignore_start_check_error option like below:

<match access.**>
  @type webhdfs
  host namenode.your.cluster.local
  port 50070
  path /log/access/%Y%m%d/${hostname}.log
  ignore_start_check_error true
</match>

For unstable Datanodes

With unstable datanodes that frequently downs, appending over WebHDFS may produce broken files. In such cases, specify append no and ${chunk_id} parameter.

<match access.**>
  @type webhdfs
  host namenode.your.cluster.local
  port 50070
  
  append no
  path   "/log/access/%Y%m%d/#{Socket.gethostname}.${chunk_id}.log"
</match>

out_webhdfs creates new files on hdfs per flush of fluentd, with chunk id. You shouldn't care broken files from append operations.

TODO

  • patches welcome!

Copyright

  • Copyright (c) 2012- TAGOMORI Satoshi (tagomoris)
  • License
    • Apache License, Version 2.0

fluent-plugin-webhdfs's People

Contributors

ashie avatar choplin avatar cosmo0920 avatar dependabot[bot] avatar eliseazure avatar jaegeunbang avatar jihyunsong avatar kkawamura avatar kmcgovern-apixio avatar kzk avatar ohjuhun avatar okkez avatar repeatedly avatar ryysud avatar skaji avatar tagomoris avatar tkengo avatar y-lan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fluent-plugin-webhdfs's Issues

Remove the label of the json data of the out webhdfs result

The result in hdfs file when using fluent-webhdfs is example below:
2014-08-20T08:25:28Z name:abc id:8754738

How can I remove the "name:" and "id:" , the result I wanted is
2014-08-20T08:25:28Z abc 8754738

Is there anyway to do that ?

output_format , just simple

Now I have a problem,

format whole data as serialized JSON, single attribute or separated multi attributes
or LTSV, labeled-TSV (see http://ltsv.org/ )

However,I just want raw data ,like input equal output
neither {“message”:"......"} or message : .....

can't write to hdfs with webhdfs

Hadoop Version is 2.4

My config:

type tail format apache path /var/log/httpd/sharebook_lab/booklab_feed_https_%Y%m%d.log tag td.apache.access

<match td..>
type geoip
geoip_lookup_key host

city ${city['host']}
latitude ${latitude['host']}
longitude ${longitude['host']}
country_code3 ${country_code3['host']}
country ${country_code['host']}
country_name ${country_name['host']}
dma ${dma_code['host']}
area ${area_code['host']}
region ${region['host']}

remove_tag_prefix td.
add_tag_prefix hdfs.

<match hdfs..>
type webhdfs
host 10.1.3.10
port 50070
path /hdfs/feed_access_%Y%m%d_%H.log

2014-04-25 17:23:40 +0800 [warn]: failed to communicate hdfs cluster, path: /hdfs/feed_access_20140425_15.log
2014-04-25 17:23:40 +0800 [warn]: temporarily failed to flush the buffer. next_retry=2014-04-25 18:34:08 +0800 error_class="SocketError" error="getaddrinfo: Name or service not known" instance=70012279940460
2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:763:in initialize' 2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:763:inopen'
2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:763:in block in connect' 2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/timeout.rb:69:intimeout'
2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/timeout.rb:100:in timeout' 2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:763:inconnect'
2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:756:in do_start' 2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:745:instart'
2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:1285:in request' 2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:1265:insend_request'
2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:281:in request' 2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:242:inoperate_requests'
2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:45:in create' 2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.2.2/lib/fluent/plugin/out_webhdfs.rb:189:inrescue in send_data'
2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.2.2/lib/fluent/plugin/out_webhdfs.rb:186:in send_data' 2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.2.2/lib/fluent/plugin/out_webhdfs.rb:205:inwrite'
2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/buffer.rb:296:in write_chunk' 2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/buffer.rb:276:inpop'
2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/output.rb:310:in try_flush' 2014-04-25 17:23:40 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/output.rb:132:inrun'

HA configuration performs incorrectly

Problem:
I am running HDFS within my Mesos cluster. It is fully HA. I have configured a matcher to point to both NameNodes. However, when the first listed NameNode is in standby mode, the standby_namenode is never used.

Expected behavior:
Connection to the namenode NameNode succeeds, finds its in standby mode, and attempts to send to standby_namenode which is now the active NameNode.

Actual results:

2018-06-12 19:28:48 +0000 [warn]: #0 [out_webhdfs] webhdfs check request failed. (namenode: name-0-node.hdfs.mesos:9002, error: {"RemoteException":{"exception":"StandbyException","javaClassName":"org.apache.hadoop.ipc.StandbyException","message":"Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error"}})

This is using td-agent 3.1.1 (fluentd 1.0.2) with the shipped fluent-plugin-webhdfs 1.2.2 plugin.

Forcing a NameNode failover caused logs to start flowing, again. However, this required manual intervention and I think the driver should do the correct thing in this state.

Output by tag like out_file (Feature Request)

When using the wildcard syntax, * doesn't get replaced with tag.
/hdfs/path/to/file/*
becomes
/hdfs/path/to/file/*.gz

Can this plugin be modified to behave more like out_file?

Thanks.

Failed use chunk_id when append default setting true

Fluentd running failed when setting using ${chunk_id} in path, but do not setting append to false.

How about fix this in generate_path:

    hdfs_path = if @append
                  path_format(chunk.key).gsub(CHUNK_ID_PLACE_HOLDER, '0')
                else
                  path_format(chunk.key).gsub(CHUNK_ID_PLACE_HOLDER, chunk_unique_id_to_str(chunk.unique_id))
                end

I am not sure it work fine or not.

getaddrinfo: Name or service not known

for my example:

  <source>
    type forward
  </source>
    <match apache.access>
      type webhdfs
      host 192.168.1.12
      port 50070
      path /weblog/access_%Y%m%d.log
      username hdfs
      flush_interval 10s
  </match>

error:

2014-07-01 17:33:59 +0800 [trace]: plugin/in_forward.rb:245:on_close: closed fluent socket object_id=15140840
2014-07-01 17:34:01 +0800 [warn]: plugin/out_webhdfs.rb:207:rescue in write: failed to communicate hdfs cluster, path: /weblog/access_20140701.log
2014-07-01 17:34:01 +0800 [warn]: fluent/output.rb:343:rescue in try_flush: temporarily failed to flush the buffer. next_retry=2014-07-01 17:34:02 +0800 error_class="SocketError" error="getaddrinfo: Name or service not known" instance=19091100
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:763:in `initialize'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:763:in `open'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:763:in `block in connect'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/timeout.rb:69:in `timeout'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/timeout.rb:100:in `timeout'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:763:in `connect'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:756:in `do_start'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:745:in `start'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:1285:in `request'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:1265:in `send_request'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:281:in `request'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:242:in `operate_requests'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:45:in `create'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.2.2/lib/fluent/plugin/out_webhdfs.rb:189:in `rescue in send_data'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.2.2/lib/fluent/plugin/out_webhdfs.rb:186:in `send_data'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.2.2/lib/fluent/plugin/out_webhdfs.rb:205:in `write'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:296:in `write_chunk'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:276:in `pop'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:310:in `try_flush'
  2014-07-01 17:34:01 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:132:in `run'

part of data missing

Hi,all
Now there is a problem when I want to kill fluentd, sleep a few seconds,I will restart it .However I found that part of the data sent to the HDFS is missing.
some data like this:(416716-548813 missing....)

2017-01-13T02:33:33Z    test    {"message":"{'msg':'cola','num':'416710'}"}
2017-01-13T02:33:33Z    test    {"message":"{'msg':'cola','num':'416711'}"}
2017-01-13T02:33:33Z    test    {"message":"{'msg':'cola','num':'416712'}"}
2017-01-13T02:33:33Z    test    {"message":"{'msg':'cola','num':'416713'}"}
2017-01-13T02:33:33Z    test    {"message":"{'msg':'cola','num':'416714'}"}
2017-01-13T02:33:33Z    test    {"message":"{'msg':'cola','num':'416715'}"}
2017-01-13T02:33:33Z    test    {"message":"{'msg':'cola','num':'416716'}"}
2017-01-13T02:33:42Z    test    {"message":"{'msg':'cola','num':'548813'}"}
2017-01-13T02:33:42Z    test    {"message":"{'msg':'cola','num':'548814'}"}
2017-01-13T02:33:42Z    test    {"message":"{'msg':'cola','num':'548815'}"}
2017-01-13T02:33:42Z    test    {"message":"{'msg':'cola','num':'548816'}"}
2017-01-13T02:33:42Z    test    {"message":"{'msg':'cola','num':'548817'}"}
2017-01-13T02:33:42Z    test    {"message":"{'msg':'cola','num':'548818'}"}
2017-01-13T02:33:42Z    test    {"message":"{'msg':'cola','num':'548819'}"}

conf:

<source>
  type tail
  log_level debug
  path /mnt/qjjia/data/coo.log
  pos_file /mnt/qjjia/data/log/hdfs.log.pos
  tag data.test
  format none
  read_from_head true
</source>
<match data.**>
...
</match>

httpFS - Do not create file if it does not exist

Hello,

We are running a MapR custer and webHDFS is not supported by MapR. So we are trying to populate hadoop using httpFS.

Our Webhdfs config :

  @type webhdfs
  host mapr-mapr-master-0
  port 14000
  path "/uhalogs/docker/docker-%M.log"
  time_slice_format %M
  flush_interval 5s
  username mapr
  httpfs true

However when using the fluentd plugin, logs are appended correclty to an existing file. But if the file does not exist (using a timestamp-based filename), we get a WebHDFS::ServerError instead of a WebHDFS::FileNotFoundError that would create the file I guess.

Error 500 received by Mapr :

{
  "RemoteException": {
    "message": "Append failed for file: /uhalogs/docker/testfile.log, error: No such file or directory (2)",
    "exception": "IOException",
    "javaClassName": "java.io.IOException"
  }
}

logs by fluentd-webhdfs plugin :

2017-01-12 13:59:09 +0000 [warn]: failed to communicate hdfs cluster, path: /uhalogs/docker/docker-58.log
2017-01-12 13:59:09 +0000 [warn]: temporarily failed to flush the buffer. next_retry=2017-01-12 14:00:13 +0000 error_class="WebHDFS::ServerError" error="{\"RemoteException\":{\"message\":\"Append failed for file: \\/uhalogs\\/docker\\/docker-58.log, error: No such file or directory (2)\",\"exception\":\"IOException\",\"javaClassName\":\"java.io.IOException\"}}" plugin_id="object:3fe5f920c960"
2017-01-12 13:59:09 +0000 [warn]: suppressed same stacktrace

related code :
https://github.com/fluent/fluent-plugin-webhdfs/blob/master/lib/fluent/plugin/out_webhdfs.rb#L262

What I am not sure and I can't find proper specifications for HttpFS on the web is :

  • Is it a bad implementation of httpFS on MapR side or should we handle this exception as well on the fluentd plugin ?

Thank You
Alban

Error reporting missing?

Hi-

I forgot to add the username parameter to the webhdfs block. No data went through and there were no error messages anywhere, not in the td-agent.log or the hadoop logs. Once I added the username, the webhdfs plugin worked and data went into HDFS files.

Is there a code path that reports errors when the WebHDFS protocol fails?

Thank you for all your work,

Lance Norskog

the webhdfs doesn't work

I installed the fluentd as a pod in k8s, it doesn't send the log to hdfs side.

My configuration like following

type tail
path /webapp/gc.log
pos_file /var/log/gc.log.pos
tag hdfs.*
format none

type webhdfs
host hdpnamenode1.synnex.org
port 50070
path /user/gc/gc.log
flush_interval 10s

the exception like following
2017-04-27T10:01:45.730896711Z Successfully installed fluent-plugin-concat-1.0.0
2017-04-27T10:01:45.731062242Z Parsing documentation for fluent-plugin-concat-1.0.0
2017-04-27T10:01:45.731079854Z Installing ri documentation for fluent-plugin-concat-1.0.0
2017-04-27T10:01:45.731092461Z Done installing documentation for fluent-plugin-concat after 0 seconds
2017-04-27T10:01:45.731109494Z 1 gem installed
2017-04-27T10:01:47.411519959Z Successfully installed fluent-mixin-type-converter-0.1.0
2017-04-27T10:01:47.411600465Z Parsing documentation for fluent-mixin-type-converter-0.1.0
2017-04-27T10:01:47.411622561Z Installing ri documentation for fluent-mixin-type-converter-0.1.0
2017-04-27T10:01:47.411642680Z Done installing documentation for fluent-mixin-type-converter after 0 seconds
2017-04-27T10:01:47.411661294Z 1 gem installed
2017-04-27T10:01:48.170906896Z 2017-04-27 10:01:48 +0000 [info]: reading config file path="/etc/td-agent/td-agent.conf"
2017-04-27T10:01:48.172375632Z 2017-04-27 10:01:48 +0000 [info]: starting fluentd-0.12.31
2017-04-27T10:01:48.392819790Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-mixin-config-placeholders' version '0.4.0'
2017-04-27T10:01:48.392882509Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-mixin-plaintextformatter' version '0.2.6'
2017-04-27T10:01:48.392899368Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-mixin-type-converter' version '0.1.0'
2017-04-27T10:01:48.392914610Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-plugin-concat' version '1.0.0'
2017-04-27T10:01:48.392929221Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-plugin-docker_metadata_filter' version '0.1.3'
2017-04-27T10:01:48.392944170Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-plugin-elasticsearch' version '1.5.0'
2017-04-27T10:01:48.392958967Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-plugin-kafka' version '0.4.1'
2017-04-27T10:01:48.392973337Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-plugin-kubernetes_metadata_filter' version '0.24.0'
2017-04-27T10:01:48.392987985Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-plugin-mongo' version '0.7.16'
2017-04-27T10:01:48.393391194Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-plugin-rewrite-tag-filter' version '1.5.5'
2017-04-27T10:01:48.393441268Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-plugin-s3' version '0.8.0'
2017-04-27T10:01:48.393457218Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-plugin-scribe' version '0.10.14'
2017-04-27T10:01:48.393471668Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-plugin-td' version '0.10.29'
2017-04-27T10:01:48.393485650Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-plugin-td-monitoring' version '0.2.2'
2017-04-27T10:01:48.393499974Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluent-plugin-webhdfs' version '0.4.2'
2017-04-27T10:01:48.393514193Z 2017-04-27 10:01:48 +0000 [info]: gem 'fluentd' version '0.12.31'
2017-04-27T10:01:48.393945922Z 2017-04-27 10:01:48 +0000 [info]: adding match pattern="hdfs.**" type="webhdfs"
2017-04-27T10:01:48.592082814Z /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/json-1.8.1/lib/json/version.rb:3: warning: already initialized constant JSON::VERSION
2017-04-27T10:01:48.592217181Z /opt/td-agent/embedded/lib/ruby/2.1.0/json/version.rb:3: warning: previous definition of VERSION was here
2017-04-27T10:01:48.592235104Z /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/json-1.8.1/lib/json/version.rb:4: warning: already initialized constant JSON::VERSION_ARRAY
2017-04-27T10:01:48.592255695Z /opt/td-agent/embedded/lib/ruby/2.1.0/json/version.rb:4: warning: previous definition of VERSION_ARRAY was here
2017-04-27T10:01:48.592276651Z /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/json-1.8.1/lib/json/version.rb:5: warning: already initialized constant JSON::VERSION_MAJOR
2017-04-27T10:01:48.592296117Z /opt/td-agent/embedded/lib/ruby/2.1.0/json/version.rb:5: warning: previous definition of VERSION_MAJOR was here
2017-04-27T10:01:48.592311493Z /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/json-1.8.1/lib/json/version.rb:6: warning: already initialized constant JSON::VERSION_MINOR
2017-04-27T10:01:48.592326563Z /opt/td-agent/embedded/lib/ruby/2.1.0/json/version.rb:6: warning: previous definition of VERSION_MINOR was here
2017-04-27T10:01:48.592344919Z /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/json-1.8.1/lib/json/version.rb:7: warning: already initialized constant JSON::VERSION_BUILD
2017-04-27T10:01:48.592365682Z /opt/td-agent/embedded/lib/ruby/2.1.0/json/version.rb:7: warning: previous definition of VERSION_BUILD was here
2017-04-27T10:01:48.599185531Z /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/json-1.8.1/lib/json/common.rb:99: warning: already initialized constant JSON::NaN
2017-04-27T10:01:48.599238535Z /opt/td-agent/embedded/lib/ruby/2.1.0/json/common.rb:99: warning: previous definition of NaN was here
2017-04-27T10:01:48.599257346Z /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/json-1.8.1/lib/json/common.rb:101: warning: already initialized constant JSON::Infinity
2017-04-27T10:01:48.599277726Z /opt/td-agent/embedded/lib/ruby/2.1.0/json/common.rb:101: warning: previous definition of Infinity was here
2017-04-27T10:01:48.599298477Z /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/json-1.8.1/lib/json/common.rb:103: warning: already initialized constant JSON::MinusInfinity
2017-04-27T10:01:48.599319034Z /opt/td-agent/embedded/lib/ruby/2.1.0/json/common.rb:103: warning: previous definition of MinusInfinity was here
2017-04-27T10:01:48.599338846Z /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/json-1.8.1/lib/json/common.rb:128: warning: already initialized constant JSON::UnparserError
2017-04-27T10:01:48.599356491Z /opt/td-agent/embedded/lib/ruby/2.1.0/json/common.rb:128: warning: previous definition of UnparserError was here
2017-04-27T10:01:48.956295741Z 2017-04-27 10:01:48 +0000 [error]: unexpected error error="No such file or directory - addr"
2017-04-27T10:01:48.956398014Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/uuidtools-2.1.5/lib/uuidtools.rb:587:in ``'
2017-04-27T10:01:48.956419942Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/uuidtools-2.1.5/lib/uuidtools.rb:587:in ifconfig' 2017-04-27T10:01:48.956443039Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/uuidtools-2.1.5/lib/uuidtools.rb:634:in mac_address'
2017-04-27T10:01:48.956501706Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/uuidtools-2.1.5/lib/uuidtools.rb:242:in `block in timestamp_create'
2017-04-27T10:01:48.956524635Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/uuidtools-2.1.5/lib/uuidtools.rb:232:in `synchronize'
2017-04-27T10:01:48.956543399Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/uuidtools-2.1.5/lib/uuidtools.rb:232:in `timestamp_create'
2017-04-27T10:01:48.956581659Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-mixin-config-placeholders-0.4.0/lib/fluent/mixin/config_placeholders.rb:37:in `uuid_timestamp'
2017-04-27T10:01:48.956603841Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-mixin-config-placeholders-0.4.0/lib/fluent/mixin/config_placeholders.rb:72:in `block (2 levels) in configure'
2017-04-27T10:01:48.956623894Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-mixin-config-placeholders-0.4.0/lib/fluent/mixin/config_placeholders.rb:41:in `call'
2017-04-27T10:01:48.956646008Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-mixin-config-placeholders-0.4.0/lib/fluent/mixin/config_placeholders.rb:41:in `block in replace'
2017-04-27T10:01:48.956700043Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-mixin-config-placeholders-0.4.0/lib/fluent/mixin/config_placeholders.rb:41:in `each'
2017-04-27T10:01:48.956725693Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-mixin-config-placeholders-0.4.0/lib/fluent/mixin/config_placeholders.rb:41:in `reduce'
2017-04-27T10:01:48.956745971Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-mixin-config-placeholders-0.4.0/lib/fluent/mixin/config_placeholders.rb:41:in `replace'
2017-04-27T10:01:48.956766620Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-mixin-config-placeholders-0.4.0/lib/fluent/mixin/config_placeholders.rb:96:in `block in configure'
2017-04-27T10:01:48.956787423Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-mixin-config-placeholders-0.4.0/lib/fluent/mixin/config_placeholders.rb:105:in `call'
2017-04-27T10:01:48.956807572Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-mixin-config-placeholders-0.4.0/lib/fluent/mixin/config_placeholders.rb:105:in `configure'
2017-04-27T10:01:48.956831800Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-mixin-plaintextformatter-0.2.6/lib/fluent/mixin/plaintextformatter.rb:21:in `configure'
2017-04-27T10:01:48.956860704Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-webhdfs-0.4.2/lib/fluent/plugin/out_webhdfs.rb:126:in `configure'
2017-04-27T10:01:48.956881164Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/agent.rb:133:in `add_match'
2017-04-27T10:01:48.956901588Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/agent.rb:64:in `block in configure'
2017-04-27T10:01:48.956936874Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/agent.rb:57:in `each'
2017-04-27T10:01:48.956957646Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/agent.rb:57:in `configure'
2017-04-27T10:01:48.956975671Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/root_agent.rb:86:in `configure'
2017-04-27T10:01:48.956993908Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/engine.rb:129:in `configure'
2017-04-27T10:01:48.957011728Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/engine.rb:103:in `run_configure'
2017-04-27T10:01:48.957029738Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/supervisor.rb:489:in `run_configure'
2017-04-27T10:01:48.957046703Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/supervisor.rb:160:in `block in start'
2017-04-27T10:01:48.957065439Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/supervisor.rb:366:in `call'
2017-04-27T10:01:48.957084106Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/supervisor.rb:366:in `main_process'
2017-04-27T10:01:48.957107124Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/supervisor.rb:339:in `block in supervise'
2017-04-27T10:01:48.957128219Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/supervisor.rb:338:in `fork'
2017-04-27T10:01:48.957152780Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/supervisor.rb:338:in `supervise'
2017-04-27T10:01:48.957173967Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/supervisor.rb:156:in `start'
2017-04-27T10:01:48.957193631Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/command/fluentd.rb:173:in `<top (required)>'
2017-04-27T10:01:48.957215585Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
2017-04-27T10:01:48.957233942Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
2017-04-27T10:01:48.957253502Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/bin/fluentd:5:in `<top (required)>'
2017-04-27T10:01:48.957280724Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/bin/fluentd:23:in `load'
2017-04-27T10:01:48.957299073Z 2017-04-27 10:01:48 +0000 [error]: /opt/td-agent/embedded/bin/fluentd:23:in `<top (required)>'
2017-04-27T10:01:48.957337491Z 2017-04-27 10:01:48 +0000 [error]: /usr/sbin/td-agent:7:in `load'
2017-04-27T10:01:48.957358040Z 2017-04-27 10:01:48 +0000 [error]: /usr/sbin/td-agent:7:in `

'
2017-04-27T10:01:48.967118286Z 2017-04-27 10:01:48 +0000 [info]: process finished code=256
2017-04-27T10:01:48.967153519Z 2017-04-27 10:01:48 +0000 [warn]: process died within 1 second. exit.

Compatability with Hadoop 2.3.0-cdh5.0.0

Hi Fluent-Crew,

I am wondering whether the webhdfs plugin has been tested with Hadoop 2.3.0 as mentioned above.

Because even though it confirms my connection when i start td-agent,:

2014-05-05 12:57:39 +0200 [info]: webhdfs connection confirmed: myhost:50070

It does complain about connection refused once i start logging:

2014-05-05 13:34:39 +0200 [warn]: temporarily failed to flush the buffer. next_retry=2014-05-05 14:07:21 +0200 error_class="Errno::ECONNREFUSED" error="Connection refused - connect(2)" instance=23619085129560

In terms of configs in hdfs-site.xml, it seems that dfs.support.append is already set to true by default (as mentioned in http://gbif.blogspot.nl/2011/01/setting-up-hadoop-cluster-part-1-manual.html) and dfs.webhdfs.enabled has also been set to true.

However, dfs.support.broken.append cannot be found in cloudera manager. So could you please tell me whether this option is really necessary to set? Of have you not been able to test on the Hadoop version as i mentioned in the subject yet?

Many thanks in advance,

Alex

httpFS - Can not create file when it does not exist

<match fluentd.test>
   @type webhdfs
   path /tmp/fluentd/test/test.log
   host myhttpfs.example.com
   port 14000
   httpfs true
   username admin
   flush_interval 5s
</match>
2020-01-30 19:17:31 +0900 [warn]: #0 failed to flush the buffer. retry_time=0 next_retry_seconds=2020-01-30 19:17:32 +0900 chunk="59d58c35c3f9c0fc061dabc8b3243994" error_class=WebHDFS::ServerError error="Failed to connect to host myhttpfs.example.com:14000, end of file reached"
  2020-01-30 19:17:31 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/webhdfs-0.8.0/lib/webhdfs/client_v1.rb:345:in `rescue in request'
  2020-01-30 19:17:31 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/webhdfs-0.8.0/lib/webhdfs/client_v1.rb:342:in `request'
  2020-01-30 19:17:31 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/webhdfs-0.8.0/lib/webhdfs/client_v1.rb:273:in `operate_requests'
  2020-01-30 19:17:31 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/webhdfs-0.8.0/lib/webhdfs/client_v1.rb:73:in `create'
  2020-01-30 19:17:31 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-webhdfs-1.2.4/lib/fluent/plugin/out_webhdfs.rb:274:in `rescue in send_data'
  2020-01-30 19:17:31 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-webhdfs-1.2.4/lib/fluent/plugin/out_webhdfs.rb:271:in `send_data'
  2020-01-30 19:17:31 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-webhdfs-1.2.4/lib/fluent/plugin/out_webhdfs.rb:389:in `block in write'
  2020-01-30 19:17:31 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-webhdfs-1.2.4/lib/fluent/plugin/out_webhdfs.rb:335:in `compress_context'
  2020-01-30 19:17:31 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-webhdfs-1.2.4/lib/fluent/plugin/out_webhdfs.rb:388:in `write'
  2020-01-30 19:17:31 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.4/lib/fluent/plugin/output.rb:1125:in `try_flush'
  2020-01-30 19:17:31 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.4/lib/fluent/plugin/output.rb:1431:in `flush_thread_run'
  2020-01-30 19:17:31 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.4/lib/fluent/plugin/output.rb:461:in `block (2 levels) in start'
  2020-01-30 19:17:31 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.4/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'                                                                                                  2020-01-30 19:17:34 +0900 [warn]: #0 failed to communicate hdfs cluster, path: /tmp/fluentd/20200130/access.log

I am using Cloudera CDH 6.1.
I have configured the plugin to use 'httpfs'.
Plugin can not create file When the file does not exist.
I read the issues-46.
I think I found the cause in the cloudera document.
Please Can you check this link?

Create and Write to a file

Note that the reason of having two-step create/append is for preventing clients to send out data before the redirect. 
This issue is addressed by the “Expect: 100-continue” header in HTTP/1.1; see RFC 2616, Section 8.2.3. 
Unfortunately, there are software library bugs(e.g. Jetty 6 HTTP server and Java 6 HTTP client), 
which do not correctly implement “Expect: 100-continue”. 
The two-step create/append is a temporary workaround for the software library bugs.

RFC 2616, Section 8.2.3.

The file was created when I tested not s ending any data.
The request must include header 'Content-Type: application/octet-stream'.

request: compression

Thank you for your great work! Could it be possible to add compression to stored compress data? gzip does it for me, but it would great to have something splittable like lzo or bz2 for fitting others needs.

Cheers!

format time differnet in logpath and webhdfs out result

In server the date command show result:
Aug 22 15:15:45

with the td-agent.conf :
<>
...
path /data/%Y%m%d%H%M%S
time_format %Y-%m-%d %H:%M:%S
...
</>
file was create with the name 20140822151545
But data time in the hadoop file is
2014-08-22 08:15:45 -------------

How can I config the time_format the same with the format time in the file path.

kerberos_keytab not authorize

Hi.

I try to connect to kerberized hdfs cluster. But can't.
Set "kerberos_keytab" to config file - but nothing change. Only if i mannually kinit user by keytab it works.

What's going on? Why fluentd can't kinit by itself?

Plugin lost file buffer when setting buffer type to file and split file by hourly

First, I notice plugin setting config_set_default :buffer_type, 'memory'
but the webhdfs page in fluentd said default buffer type if file.

Issue:
I hope split file by hourly, and split file with 1G limit:

## hdfs file will split by hourly
path /fluentd/__TAG__/__TAG__-%Y%m%d_%H-${hostname}-${chunk_id}.log
## disable append
append false
## using file buffer and chunk_limit is 1G
buffer_type file
buffer_path /mnt1/.fluentd_s3/__TAG__
buffer_chunk_limit 1G
flush_interval 1h

but I found when a new hour coming, last hour buffer which not came chunk_limit buffer file lost, the file buffer stored local, do not write to HDFS:
local buffer:

$ ll /mnt1/.fluentd_buffer/hdfs-flood*
-rw-r--r-- 1 root root 761827225 May 28 19:59 /mnt1/.fluentd_buffer/hdfs-flood.2015052819.b5172fa110175e555.log
-rw-r--r-- 1 root root 218389725 May 28 20:13 /mnt1/.fluentd_buffer/hdfs-flood.2015052820.b5172fdaac185fdbf.log

hdfs files:

$ hadoop fs -ls -R /fluentd/hdfs-flood
-rwxr-xr-x   1 hadoop supergroup 1073740925 2015-05-28 19:48 /fluentd/hdfs-flood/hdfs-flood-20150528_19-ip-172-10-1-100-5172f72f0e460de85172f72f0e460de8.log
-rwxr-xr-x   1 hadoop supergroup 1073740925 2015-05-28 19:52 /fluentd/hdfs-flood/hdfs-flood-20150528_19-ip-172-10-1-100-5172f82516163c435172f82516163c43.log
-rwxr-xr-x   1 hadoop supergroup 1073740925 2015-05-28 19:57 /fluentd/hdfs-flood/hdfs-flood-20150528_19-ip-172-10-1-100-5172f91aed4ddf635172f91aed4ddf63.log
-rwxr-xr-x   1 hadoop supergroup 1073740925 2015-05-28 20:04 /fluentd/hdfs-flood/hdfs-flood-20150528_20-ip-172-10-1-100-5172fabfe72fb52f5172fabfe72fb52f.log
-rwxr-xr-x   1 hadoop supergroup 1073740925 2015-05-28 20:08 /fluentd/hdfs-flood/hdfs-flood-20150528_20-ip-172-10-1-100-5172fbb42ea7c9605172fbb42ea7c960.log

The buffer file /mnt1/.fluentd_s3/hdfs-flood.2015052819.b5172fa110175e555.log do not flush to HDFS!

Temporarily failed to flush the buffer => RemoteException: AlreadyBeingCreatedException

HI guys,

Recently we are seeing the error above quite regularly, it seems this is failing to flush the buffer as it is trying to create a file with a name, which has already been created on HDFS.
So I was wondering whether it means we should implement what you called the "For unstable Datanodes" settings? (with append no and chunk id)

Our current config

type webhdfs
host 172.18.90.16
port 50070
path /my/location/dt=%Y-%m-%d/%H.log
flush_interval 10s
buffer_queue_limit 128
username hdfs

field_separator TAB
output_include_time false
output_include_tag false
remove_prefix access

output_data_type attr:log

Unable to close file because the last block does not have enough number of replicas.

HI guys,

Recently we are seeing the error above quite regularly, it seems this is failing to flush the buffer as it is trying to create a file with a name, which has already been created on HDFS.
and
http://stackoverflow.com/questions/24366490/use-fluent-to-collect-data-and-append-to-hdfs-throw-the-alreadybeingcreatedexce
and now i can't write to hdfs

Error is as follows

2014-08-20 19:30:29 +0800 [warn]: failed to communicate hdfs cluster, path: /weblog/access/day=20140820/localhost.log
2014-08-20 19:30:29 +0800 [warn]: temporarily failed to flush the buffer. next_retry=2014-08-20 19:30:04 +0800 error_class="WebHDFS::IOError" error="{\"RemoteException\":{\"exception\":\"IOException\",\"javaClassName\":\"java.io.IOException\",\"message\":\"Unable to close file because the last block does not have enough number of replicas.\"}}" instance=69823638713360
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:317:in `request'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:242:in `operate_requests'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:56:in `append'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.2.2/lib/fluent/plugin/out_webhdfs.rb:187:in `send_data'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.2.2/lib/fluent/plugin/out_webhdfs.rb:205:in `write'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:296:in `write_chunk'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:276:in `pop'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:310:in `try_flush'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:132:in `run'
2014-08-20 19:30:29 +0800 [warn]: failed to communicate hdfs cluster, path: /weblog/access/day=20140820/localhost.log
2014-08-20 19:30:29 +0800 [warn]: temporarily failed to flush the buffer. next_retry=2014-08-20 19:30:05 +0800 error_class="WebHDFS::IOError" error="{\"RemoteException\":{\"exception\":\"AlreadyBeingCreatedException\",\"javaClassName\":\"org.apache.hadoop.hdfs.protocol.AlreadyBeingCreatedException\",\"message\":\"Failed to create file [/weblog/access/day=20140820/localhost.log] for [DFSClient_NONMAPREDUCE_-1338562566_570303] on client [192.168.166.203], because this file is already being created by [DFSClient_NONMAPREDUCE_2086608883_519513] on [192.168.166.210]\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.recoverLeaseInternal(FSNamesystem.java:2534)\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFileInternal(FSNamesystem.java:2369)\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFileInt(FSNamesystem.java:2598)\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFile(FSNamesystem.java:2561)\\n\\tat org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.append(NameNodeRpcServer.java:522)\\n\\tat org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.append(ClientNamenodeProtocolServerSideTranslatorPB.java:373)\\n\\tat org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)\\n\\tat org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585)\\n\\tat org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1026)\\n\\tat org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1986)\\n\\tat org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1982)\\n\\tat java.security.AccessController.doPrivileged(Native Method)\\n\\tat javax.security.auth.Subject.doAs(Subject.java:415)\\n\\tat org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1548)\\n\\tat org.apache.hadoop.ipc.Server$Handler.run(Server.java:1980)\\n\"}}" instance=69823638713360
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:317:in `request'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:242:in `operate_requests'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:56:in `append'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.2.2/lib/fluent/plugin/out_webhdfs.rb:187:in `send_data'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.2.2/lib/fluent/plugin/out_webhdfs.rb:205:in `write'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:296:in `write_chunk'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:276:in `pop'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:310:in `try_flush'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:132:in `run'
2014-08-20 19:30:29 +0800 [warn]: failed to communicate hdfs cluster, path: /weblog/access/day=20140820/localhost.log
2014-08-20 19:30:29 +0800 [warn]: temporarily failed to flush the buffer. next_retry=2014-08-20 19:30:09 +0800 error_class="WebHDFS::IOError" error="{\"RemoteException\":{\"exception\":\"AlreadyBeingCreatedException\",\"javaClassName\":\"org.apache.hadoop.hdfs.protocol.AlreadyBeingCreatedException\",\"message\":\"Failed to create file [/weblog/access/day=20140820/localhost.log] for [DFSClient_NONMAPREDUCE_318222613_675838] on client [192.168.166.209], because this file is already being created by [DFSClient_NONMAPREDUCE_2086608883_519513] on [192.168.166.210]\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.recoverLeaseInternal(FSNamesystem.java:2534)\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFileInternal(FSNamesystem.java:2369)\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFileInt(FSNamesystem.java:2598)\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFile(FSNamesystem.java:2561)\\n\\tat org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.append(NameNodeRpcServer.java:522)\\n\\tat org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.append(ClientNamenodeProtocolServerSideTranslatorPB.java:373)\\n\\tat org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)\\n\\tat org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585)\\n\\tat org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1026)\\n\\tat org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1986)\\n\\tat org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1982)\\n\\tat java.security.AccessController.doPrivileged(Native Method)\\n\\tat javax.security.auth.Subject.doAs(Subject.java:415)\\n\\tat org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1548)\\n\\tat org.apache.hadoop.ipc.Server$Handler.run(Server.java:1980)\\n\"}}" instance=69823638713360
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:317:in `request'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:242:in `operate_requests'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:56:in `append'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.2.2/lib/fluent/plugin/out_webhdfs.rb:187:in `send_data'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.2.2/lib/fluent/plugin/out_webhdfs.rb:205:in `write'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:296:in `write_chunk'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:276:in `pop'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:310:in `try_flush'
  2014-08-20 19:30:29 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:132:in `run'
2014-08-20 19:30:29 +0800 [warn]: failed to communicate hdfs cluster, path: /weblog/access/day=20140820/localhost.log
2014-08-20 19:30:29 +0800 [warn]: temporarily failed to flush the buffer. next_retry=2014-08-20 19:30:18 +0800 error_class="WebHDFS::IOError" error="{\"RemoteException\":{\"exception\":\"AlreadyBeingCreatedException\",\"javaClassName\":\"org.apache.hadoop.hdfs.protocol.AlreadyBeingCreatedException\",\"message\":\"Failed to create file [/weblog/access/day=20140820/localhost.log] for [DFSClient_NONMAPREDUCE_-291834276_570303] on client [192.168.166.203], because this file is already being created by [DFSClient_NONMAPREDUCE_2086608883_519513] on [192.168.166.210]\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.recoverLeaseInternal(FSNamesystem.java:2534)\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFileInternal(FSNamesystem.java:2369)\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFileInt(FSNamesystem.java:2598)\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFile(FSNamesystem.java:2561)\\n\\tat org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.append(NameNodeRpcServer.java:522)\\n\\tat org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.append(ClientNamenodeProtocolServerSideTranslatorPB.java:373)\\n\\tat org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)\\n\\tat org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585)\\n\\tat org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1026)\\n\\tat org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1986)\\n\\tat org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1982)\\n\\tat java.security.AccessController.doPrivileged(Native Method)\\n\\tat javax.security.auth.Subject.doAs(Subject.java:415)\\n\\tat org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1548)\\n\\tat org.apache.hadoop.ipc.Server$Handler.run(Server.java:1980)\\n\"}}" instance=69823638713360

Operation category READ is not supported in state standby

Hi All,
Please help to solve this issue. we are using fluentd as our central log forwarder. we are getting lot of backlog records in file buffer due to webhdfs unable to flush to hadoop. This is due to fluentd getting "Read not support in standby" and it succeed after fluentd retry.
There is no issue when Primary hadoop node is active. But when hadoop active node become standby and standby become active and switch back, fluentd not able to reset to previous active node. please advise with correct settings to for handling HA in webhdfs plugin.

namenode $namenode_host
standby_namenode $standy_host

2021-09-02 13:06:57 +0000 [warn]: #11 [out_hdfs] failed to communicate hdfs cluster, path: /xxx/hadoopfs/2021/09/02/srv/20210902_1304_5cb02d28f56a255edbe3c8364e3c3c3a.bz2
2021-09-02 13:06:57 +0000 [warn]: #11 [out_hdfs] webhdfs check request failed. (namenode: $hadoohost:port, error: {"RemoteException":{"exception":"StandbyException","javaClassName":"org.apache.hadoop.ipc.StandbyException","message":"Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error"}})
2021-09-02 13:06:57 +0000 [warn]: #11 [out_hdfs] failed to flush the buffer. retry_time=0 next_retry_seconds=2021-09-02 13:06:58.650648326 +0000 chunk="5cb02d28f56a255edbe3c8364e3c3c3a" error_class=WebHDFS::ServerError error="Failed to connect to host $hadoohost:port, Net::ReadTimeout with #TCPSocket:(closed)"
2021-09-02 13:06:57 +0000 [warn]: #11 suppressed same stacktrace
2021-09-02 13:06:58 +0000 [warn]: #11 [out_hdfs] retry succeeded. chunk_id="5cb02d28f56a255edbe3c8364e3c3c3a"

Error after changing a time_slice_format part in path

symptom

"invalid strptime format" error occurs after changing path configuration.

how to repoduce

1 set a config file as below.

type webhdfs
buffer_type file
path /tmp/test_%Y%m%d

# and other reauired configs ...

2 start fluentd.
3 input some logs fluentd.
4 stop fluentd before output these logs.
5 change path in the config file.

type webhdfs
buffer_type file
path /tmp/test_%Y%m%d_%H # add _%H

# and other reauired configs ...

6 restart fluentd
7 an error occurs when chunk is emitted

2013-06-25 13:16:43 +0000 [warn]: temporarily failed to flush the buffer, next retry will be at 2013-06-25 13:16:44 +0000. error="invalid strptime format - `%Y%m%d%H'" instance=17811120

cause

After restarting fluentd, the buffer chunk in the file buffer has key formated with the previous time_slice_format, i.e. '%Y%m%d', and key is '20130625' consequently. However, the current time_slice_format, '%Y%m%d%H', cannot parse '20130625'.

solve

One possible plan is to shorten or pad chunk_key when a lenght of chunk_key differs a length of time_slice_format. Any other idea?

Can hdfs path use ${tag} or ${record} ? just like: /data/hdfs/${tag}.#{Socket.gethostname}.log

Hello,
I use 'fluent-plugin-webhdfs' version '1.2.2', fluentd version: 1.4
My log file looks like:
interface=login&time=20170925&...others fields...
In my td-agent config file, I named my log as a tag:interface.login.hdfs

<source>
  @type tail
  format none
  path /data/td-agent/logs/interface.log
  pos_file /etc/td-agent/pos/interface.pos
  read_from_head true
  tag interface.**login**.hdfs
</source>
<match interface.**>
  @type webhdfs
  host *.*.*.*
  port 50070
  path /data/gamelogs/hdfs/date=${record['time']}/${tag[2]}.#{Socket.gethostname}.log
  <format>
    @type json
  </format>
</match>

and I need to get "login" from tag, and get time from my log record, so if there has any method to get these two values?

In some other plugins, I can use $tag[2] or ${record['interface']}, ${record['time']} to get these values,but in this plugin, it doesn't work.
Thanks...

can‘t input info with webhdfs?!

log:

2014-12-03 15:57:59 +0800 [warn]: failed to communicate hdfs cluster, path: /log/20141203_15/access.log.node1.test.com
2014-12-03 15:57:59 +0800 [warn]: temporarily failed to flush the buffer. next_retry=2014-12-03 15:59:56 +0800 error_class="WebHDFS::ClientError" error="{"RemoteException":{"exception":"IllegalArgumentException","javaClassName":"java.lang.IllegalArgumentException","message":"n must be positive"}}" instance=23456251808160
2014-12-03 15:57:59 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:313:in request' 2014-12-03 15:57:59 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:231:inoperate_requests'
2014-12-03 15:57:59 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:45:in create' 2014-12-03 15:57:59 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.3.1/lib/fluent/plugin/out_webhdfs.rb:189:inrescue in send_data'
2014-12-03 15:57:59 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.3.1/lib/fluent/plugin/out_webhdfs.rb:186:in send_data' 2014-12-03 15:57:59 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.3.1/lib/fluent/plugin/out_webhdfs.rb:205:inwrite'
2014-12-03 15:57:59 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/buffer.rb:296:in write_chunk' 2014-12-03 15:57:59 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/buffer.rb:276:inpop'
2014-12-03 15:57:59 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/output.rb:311:in try_flush' 2014-12-03 15:57:59 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/output.rb:132:inrun'
2014-12-03 15:59:57 +0800 [warn]: failed to communicate hdfs cluster, path: /log/20141203_15/access.log.node1.test.com
2014-12-03 15:59:57 +0800 [warn]: temporarily failed to flush the buffer. next_retry=2014-12-03 16:04:35 +0800 error_class="WebHDFS::ClientError" error="{"RemoteException":{"exception":"IllegalArgumentException","javaClassName":"java.lang.IllegalArgumentException","message":"n must be positive"}}" instance=23456251808160
2014-12-03 15:59:57 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:313:in request' 2014-12-03 15:59:57 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:231:inoperate_requests'
2014-12-03 15:59:57 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/webhdfs-0.5.5/lib/webhdfs/client_v1.rb:45:in create' 2014-12-03 15:59:57 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.3.1/lib/fluent/plugin/out_webhdfs.rb:189:inrescue in send_data'
2014-12-03 15:59:57 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.3.1/lib/fluent/plugin/out_webhdfs.rb:186:in send_data' 2014-12-03 15:59:57 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-webhdfs-0.3.1/lib/fluent/plugin/out_webhdfs.rb:205:inwrite'
2014-12-03 15:59:57 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/buffer.rb:296:in write_chunk' 2014-12-03 15:59:57 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/buffer.rb:276:inpop'
2014-12-03 15:59:57 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/output.rb:311:in try_flush' 2014-12-03 15:59:57 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/output.rb:132:inrun'

test:
curl -X POST -d 'json={"action":"login","user":2}' http://node1.test.com:8888/hdfs.access.test

have any info in hdfs:
hadoop fs -ls /log

Error installing fluent-plugin-webhdfs

root@e100069201209:/fluentd# fluent-gem install fluent-plugin-webhdfs -v 1.2.3
Building native extensions. This could take a while...
ERROR: Error installing fluent-plugin-webhdfs:
ERROR: Failed to build gem native extension.

current directory: /fluentd/vendor/bundle/ruby/2.3.0/gems/strptime-0.2.3/ext/strptime

/usr/bin/ruby2.3 -r ./siteconf20180426-316-14zhkeg.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /fluentd/vendor/bundle/ruby/2.3.0/gems/strptime-0.2.3 for inspection.
Results logged to /fluentd/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/strptime-0.2.3/gem_make.out

Compression Snappy is not work.

/etc/td-agent/td-agent.conf

<source>
  @type kafka_group
  brokers localhost:9092
  consumer_group test
  topics TEST
  add_prefix fluentd
  add_suffix log
  format json
  start_from_beginning false
</source>

<match fluentd.TEST.log>
  @type copy
  <store>
    @type webhdfs
    namenode localhost:50070

    path /user/test/%Y/%m/%d/%H/%M/test-%Y%m%d%H%M.log
    compress snappy

    <format>
      @type single_value
      add_newline false
      message_key message
    </format>

    <buffer>
      @type file
      path /data/td-agent
      flush_mode interval
      flush_interval 1s
    </buffer>
  </store>
</match>

/var/log/td-agent/td-agent.log

2020-05-29 09:44:56 +0900 [warn]: #0 failed to communicate hdfs cluster, path: /user/test/2020/05/29/09/44/test-202005290944.log.sz
2020-05-29 09:44:56 +0900 [warn]: #0 got unrecoverable error in primary and no secondary error_class=TypeError error="no implicit conversion from nil to integer"
  2020-05-29 09:44:56 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin/buffer/chunk.rb:180:in `copy_stream'
  2020-05-29 09:44:56 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin/buffer/chunk.rb:180:in `block in write_to'
  2020-05-29 09:44:56 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin/buffer/file_chunk.rb:171:in `open'
  2020-05-29 09:44:56 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin/buffer/chunk.rb:179:in `write_to'
  2020-05-29 09:44:56 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-webhdfs-1.2.4/lib/fluent/plugin/webhdfs_compressor_snappy.rb:20:in `compress'
  2020-05-29 09:44:56 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-webhdfs-1.2.4/lib/fluent/plugin/out_webhdfs.rb:333:in `compress_context'
  2020-05-29 09:44:56 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-webhdfs-1.2.4/lib/fluent/plugin/out_webhdfs.rb:388:in `write'
  2020-05-29 09:44:56 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin/output.rb:1133:in `try_flush'
  2020-05-29 09:44:56 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin/output.rb:1439:in `flush_thread_run'
  2020-05-29 09:44:56 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin/output.rb:461:in `block (2 levels) in start'
  2020-05-29 09:44:56 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'
2020-05-29 09:44:56 +0900 [warn]: #0 bad chunk is moved to /tmp/fluent/backup/worker0/object_3fd23738e570/5a6bec0edcd08f897fc647e296fac35b.log

I am using td-agent 3.7.1

The snappy gem was downloaded from ruby.gem (https://rubygems.org/gems/snappy). version is 0.0.17.

Messages stored in kafka are stored in JSON format.

  • ex. {"a": "a1", "b": "b1"}

I know that the current compression method supports gzip, snappy, bzip2, and lzo_command. I want to compress with snappy but I get the above error. I have confirmed that other compression methods (gzip, bzip2, lzo_command) work fine.

When try to append to file more often then default timekey, exception happens

Here is my config

<match iotop.0 >
    @type copy
    deep_copy true

    <store>
        @type webhdfs
        namenode          master1.hdoo.com:50070 
        standby_namenode  master2.hdoo.com:50070
        path  "/raw/iostats/%Y%m%d/%H/#{Socket.gethostname}.log"
        compress gzip  # or 'bzip2', 'snappy', 'lzo_command'
        retry_known_errors yes
        retry_interval 65
        open_timeout 180
        read_timeout 180
        append yes
        username fluent
        ignore_start_check_error true
        <buffer>
           @type   file
           flush_interval 1m
           timekey  10m
           path  /var/spool/td-agent/fluentd_buffer_fwebhdfs/
        </buffer>
        <format>
           @type csv
           fields UNIXTIME,USER,DISKREAD,DISKWRITE
           force_quotes false 
        </format>
        <secondary>
          @type secondary_file
          directory /var/spool/td-agent/webhdfs_failed/
        </secondary>
    </store>


</match>

The goal is to sync data down to hadoop every 10 min even if file is %H based. Every time the flush process start, the following issue appears

2018-11-19 13:40:31 +0000 [warn]: #19 failed to flush the buffer. retry_time=0 next_retry_seconds=2018-11-19 13:40:32 +0000 chunk="57b048883d347b0ca22650dac40e1961" error_class=WebHDFS::IOError error="{\"RemoteException\":{\"exception\":\"AlreadyBeingCreatedException\",\"javaClassName\":\"org.apache.hadoop.hdfs.protocol.AlreadyBeingCreatedException\",\"message\":\"Failed to create file [/raw/iostats/20181119/13/fluentd1.log.gz] for [DFSClient_NONMAPREDUCE_1591351286_116] for client [10.64.11.19], because this file is already being created by [DFSClient_NONMAPREDUCE_1898391037_115] on [10.64.11.19]\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.recoverLeaseInternal(FSNamesystem.java:3276)\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFileInternal(FSNamesystem.java:3056)\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFileInt(FSNamesystem.java:3341)\\n\\tat org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFile(FSNamesystem.java:3305)\\n\\tat org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.append(NameNodeRpcServer.java:621)\\n\\tat org.apache.hadoop.hdfs.server.namenode.AuthorizationProviderProxyClientProtocol.append(AuthorizationProviderProxyClientProtocol.java:129)\\n\\tat org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.append(ClientNamenodeProtocolServerSideTranslatorPB.java:433)\\n\\tat org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)\\n\\tat org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:617)\\n\\tat org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1073)\\n\\tat org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2226)\\n\\tat org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2222)\\n\\tat java.security.AccessController.doPrivileged(Native Method)\\n\\tat javax.security.auth.Subject.doAs(Subject.java:415)\\n\\tat org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1917)\\n\\tat org.apache.hadoop.ipc.Server$Handler.run(Server.java:2220)\\n\"}}"
  2018-11-19 13:40:31 +0000 [warn]: #19 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/webhdfs-0.8.0/lib/webhdfs/client_v1.rb:401:in `request'
  2018-11-19 13:40:31 +0000 [warn]: #19 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/webhdfs-0.8.0/lib/webhdfs/client_v1.rb:270:in `operate_requests'
  2018-11-19 13:40:31 +0000 [warn]: #19 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/webhdfs-0.8.0/lib/webhdfs/client_v1.rb:84:in `append'
  2018-11-19 13:40:31 +0000 [warn]: #19 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-webhdfs-1.2.3/lib/fluent/plugin/out_webhdfs.rb:272:in `send_data'
  2018-11-19 13:40:31 +0000 [warn]: #19 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-webhdfs-1.2.3/lib/fluent/plugin/out_webhdfs.rb:389:in `block in write'
  2018-11-19 13:40:31 +0000 [warn]: #19 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-webhdfs-1.2.3/lib/fluent/plugin/out_webhdfs.rb:335:in `compress_context'
  2018-11-19 13:40:31 +0000 [warn]: #19 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-webhdfs-1.2.3/lib/fluent/plugin/out_webhdfs.rb:388:in `write'
  2018-11-19 13:40:31 +0000 [warn]: #19 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.2.6/lib/fluent/plugin/output.rb:1111:in `try_flush'
  2018-11-19 13:40:31 +0000 [warn]: #19 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.2.6/lib/fluent/plugin/output.rb:1394:in `flush_thread_run'
  2018-11-19 13:40:31 +0000 [warn]: #19 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.2.6/lib/fluent/plugin/output.rb:445:in `block (2 levels) in start'
  2018-11-19 13:40:31 +0000 [warn]: #19 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.2.6/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'

Then next second retry with success

2018-11-19 13:40:32 +0000 [warn]: #19 retry succeeded. chunk_id="57b048883d347b0ca22650dac40e1961"

Is it expected behavior?
We use Cloudera Manager 5.13.0-1.cm5130.p0.55~wheezy-cm5 as hadoop implementation.

use chunk_id in path

According to your documentation it is allowed to use

path "/log/access/%Y%m%d/#{Socket.gethostname}.${chunk_id}.log"

In my case

path "/raw/syslog/logdate=%Y%m%d/loghour=%H/#{Socket.gethostname}.${chunk_id}.journald.log"

failed to communicate hdfs cluster, path: /raw/syslog/logdate=20190625/loghour=07/fluentd3.2019-06-25 08:11:10 +0000 [warn]: #10 ${chunk_id} is not allowed in this plugin. Pass Chunk instead of metadata in extract_placeholders's 2nd argument.journald.log.gz

It is acceptable to use worker_id as fluent/fluentd#1473 in my case only.

Kerberos Keytab example

Hi, Can someone give an example how to configure this plugin to use a kerberos keytab and principal ? having just kerberos=true does not help a lot. thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.