Read JSON objects from JSON file with Filebeat

I have .json file that has json object on each line, example content:

{"method":"GET","path":"/-/metrics","format":"html","controller":"MetricsController","action":"index","status":200,"duration":4.53,"view":1.06,"db":0.0,"time":"2019-01-04T00:57:41.667Z","params":[],"remote_ip":null,"user_id":null,"username":null}
{"method":"GET","path":"/asd/gui/commit/d043928ddb3sd625ca7dc041f999b8273341b1ac7","format":"html","controller":"Projects::CommitController","action":"show","status":0,"duration":9.58,"view":0.0,"db":0.09,"time":"2019-01-04T00:57:55.950Z","params":[{"key":"namespace_id","value":"asd"},{"key":"project_id","value":"gui"},{"key":"id","value":"d043928ddb3sd625ca7dc041f999b8273341b1ac7"}],"remote_ip":"11.111.111.111","user_id":null,"username":null}
{"method":"GET","path":"/-/metrics","format":"html","controller":"MetricsController","action":"index","status":200,"duration":3.3,"view":0.69,"db":0.0,"time":"2019-01-04T00:57:56.658Z","params":[],"remote_ip":null,"user_id":null,"username":null}
{"method":"GET","path":"/Smith.Smith/MoodleTheme/graphs/909c9381c322f45asdea219e90cf90d502klk21f/charts","format":"html","controller":"Projects::GraphsController","action":"charts","status":0,"duration":7.68,"view":0.0,"db":0.04,"time":"2019-01-04T00:57:57.623Z","params":[{"key":"namespace_id","value":"Smith.Smith"},{"key":"project_id","value":"MoodleTheme"},{"key":"id","value":"909c9381c322f45asdea219e90cf90d502klk21f"}],"remote_ip":"11.111.111.111","user_id":null,"username":null}

Filebeat configuration:

logging.level: debug
logging.to_files: true
logging.files:
  path: /usr/share/filebeat/logs
  name: debug.log
logging.selectors: ["*"]

filebeat.inputs:
- type: log
  paths:
  - /path/to/file.json
  json.keys_under_root: false
  json.overwrite_keys: true
  json.add_error_key: true
  fields:
    gitlab_log: true

output.logstash:
  hosts: ["logging_system_graylog_1:5044"]

And graylog input configuration:

{
    "name":"Beats input",
    "description":"Adds a global Beats input on port 5044",
    "category":"Inputs",
    "inputs":[
      {
        "title": "beats input",
        "configuration": {
          "recv_buffer_size": 1048576,
          "port": 5044,
          "tls_key_file": null,
          "tls_enable": false,
          "tls_key_password": null,
          "tcp_keepalive": false,
          "tls_client_auth_cert_file": null,
          "tls_client_auth": "disabled",
          "override_source": null,
          "bind_address": "logging_system_graylog_1",
          "tls_cert_file": null
        },
        "static_fields":{},
        "type":"org.graylog.plugins.beats.BeatsInput",
        "global":true,
        "extractors":[]
      }
    ]
  }

I am able to get each line form the .json file to graylog, but the 'message' and 'type' are null in Graylog. Is the problem in my Filebeat configuration or somewhere else?

Any help is much appreciated!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.