yokawasa/fluent-plugin-azure-loganalytics

'undefined method `code' for nil:NilClass'

Closed this issue · 1 comments

Fluentd version 1.15.2 (c32842297ed2c306f1b841a8f6e55bdd0f1cb27f)

Fluend config:

<source>
@type tail
path /log
pos_file /log.pos
read_from_head true
tag azure
<parse>
  @type apache2
</parse>
</source>

<match azure>
    @type azure-loganalytics
    customer_id xxxx
    shared_key xxxx
    log_type  ApacheAccessLog
</match>

The config is referenced from the example config in this plugin README, the log is from the Fluentd provided example log in the apache2 parser section. This is to simulate the scenario of sending apache logs to azure log-analytics.
sample log:
192.168.0.1 - - [28/Feb/2013:12:00:00 +0900] "GET / HTTP/1.1" 200 777 "-" "Opera/12.0"
However, I got the error listed below, it seems a ruby error. Did I config it wrong? I tried using fluent bit to send the similar log and azure received it.

#0 Exception occured in posting to DataCollector API: 'undefined method `code' for nil:NilClass', data=>[{"host":"192.168.0.1","user":null,"method":"GET","path":"/","code":200,"size":777,"referer":null,"agent":"Opera/12.0","time":"1362020400"},{"host":"192.168.0.1","user":null,"method":"GET","path":"/","code":200,"size":777,"referer":null,"agent":"Opera/12.0","time":"1362020400"},{"host":"192.168.0.1","user":null,"method":"GET","path":"/","code":200,"size":777,"referer":null,"agent":"Opera/12.0","time":"1362020400"},{"host":"192.168.0.1","user":null,"method":"GET","path":"/","code":200,"size":777,"referer":null,"agent":"Opera/12.0","time":"1362020400"}]

The issue is due to the network connection is lost.