# Author: Justin Henderson
#         SANS Instructor and author of SANS SEC555: SIEM and Tactical Analytics
# Updated by: Doug Burks
# Last Update: 2/7/2018
#
# This conf file is based on accepting logs for intel.log from Bro systems
filter {
  if [type] == "bro_intel" {
        # If message looks like json, try to parse it as such. Otherwise, fall back to csv or grok.
        if [message] =~ /^{.*}$/ {
                json {
                        source => "message"
                }

                mutate {
                        rename => { "ts" => "timestamp" }
                        #uid
                        rename => { "id.orig_h" => "source_ip" }
                        rename => { "id.orig_p" => "source_port" }
                        rename => { "id.resp_h" => "destination_ip" }
                        rename => { "id.resp_p" => "destination_port" }
			rename => { "seen.indicator" => "indicator" }
			rename => { "seen.indicator_type" => "indicator_type" }
			rename => { "seen.where" => "seen_where" }
			rename => { "seen.node" => "seen_node" }
			#matched
			#sources
			#fuid
			rename => { "file_mime_type" => "mimetype" }
			rename => { "file_desc" => "file_description" }
		}
	} else {
	    mutate {
	      gsub => [ "message", "[\"']", "" ]
	    }
	    csv {
	      columns => ["timestamp","uid","source_ip","source_port","destination_ip","destination_port","indicator","indicator_type","seen_where","seen_node","matched","sources","fuid","mimetype","file_description"]
	      separator => "	"
	    }
	}

	mutate {
		#add_tag => [ "conf_file_1124"]
	}
  }	
}
