ini Logstash手表码头日志

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ini Logstash手表码头日志相关的知识,希望对你有一定的参考价值。

input {
  file {
    codec => json
    path => '/var/lib/docker/containers/*/*-json.log'
  }
}
filter {
  ruby {
    code => "Thread.current[event['path']] ||= JSON.parse(Pathname(event['path']).dirname.join('config.json').read)"
  }
  ruby {
    code => "event['container_name'] = Thread.current[event['path']].fetch('Name', '<missing>')"
  }
  ruby {
    code => "event['container_image'] = Thread.current[event['path']]['Config'].fetch('Image', '<missing>')"
  }
}
output {
  stdout {
    codec => rubydebug
  }
}

ini IIS日志的Logstash配置。

input {
	file {
		type => "IISLog"
		path => "C:/inetpub/logs/LogFiles/W3SVC*/*.log"
		start_position => "beginning"
	}
}

filter {

	# ignore log comments
	if [message] =~ "^#" {
		drop {}
	}
 
 	# check that fields match your IIS log settings
	grok {
        match => ["message", "%{TIMESTAMP_ISO8601:log_timestamp} %{IPORHOST:site} %{WORD:method} %{URIPATH:page} %{NOTSPACE:querystring} %{NUMBER:port} %{NOTSPACE:username} %{IPORHOST:clienthost} %{NOTSPACE:useragent} (%{URI:referer})? %{NUMBER:response} %{NUMBER:subresponse} %{NUMBER:scstatus} %{NUMBER:time_taken}"]
	}
  
	# set the event timestamp from the log
	# https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html
	date {
		match => [ "log_timestamp", "YYYY-MM-dd HH:mm:ss" ]
		timezone => "Etc/UCT"
	}
	
	# matches the big, long nasty useragent string to the actual browser name, version, etc
	# https://www.elastic.co/guide/en/logstash/current/plugins-filters-useragent.html
	useragent {
		source=> "useragent"
		prefix=> "browser_"
	}
	
	mutate {
		remove_field => [ "log_timestamp"]
	}
}

# output logs to console and to elasticsearch
output {
    stdout { codec => rubydebug }
	elasticsearch { hosts => ["localhost:9200"] }
}

以上是关于ini Logstash手表码头日志的主要内容,如果未能解决你的问题,请参考以下文章

ini 使用ELK堆栈(Elasticsearch + Logstash + Kibana)进行脱机SSHD日志分析

ini 使用nxlog和JSON传输将Windows事件日志信息记录到Logstash

ini Logstash配置使用编解码器多线解析Scala / Java日志,以将异常和堆栈跟踪消息连接到单个事件和gro中

ini Logstash配置使用编解码器多线解析Scala / Java日志,以将异常和堆栈跟踪消息连接到单个事件和gro中

ini logstash-inputfile.conf

ini logstash.conf