How to import old log files to graylog as input?

后端 未结 1 372
悲&欢浪女
悲&欢浪女 2021-01-01 05:34

I am able to to setup graylog-server and graylog-web and able to setup input for generated log of apache2, tomcat and other applications with the help of graylog-collector

相关标签:
1条回答
  • 2021-01-01 06:12

    I am able to see my old log files (.log file) in graylog-web with help of logstash.

    I just installed logstash and created a simple logstash configuration file having content

    input {
      file {
        path => "/home/alok/Downloads/old_apache_access.log"
        start_position => "beginning"
      }
    }
    
    #filter {
    #    add filter according to need
    #}
    
    output {
      gelf {
        host => "10.149.235.66"
     }
    }
    

    path is path for my old log file that I want to import to graylog.
    start_position tell logstash from where log lines to be read.
    gelf to output logs in graylog's format.
    host is address of graylog server.

    now I can run logstash to read log file by running command.
    $/opt/logstash/bin/logstash -f /etc/logstash/conf.d/logstash-simple.conf

    Now I will add input in graylog for receiving logs from logstash. for that in main menu goto System >> Inputs

    enter image description here

    Then choose GELF UDP and lauch this newly selected input and give title to this and finally click on launch button.

    enter image description here

    Now one can see newly created input and click on Show received messages to see logs

    0 讨论(0)
提交回复
热议问题