Hello everyone, I have the following situation, I am reading the logs from a file and these come as follows:
- Jun 12 23:29:08 172.17.6.10 field1="value1" field2=value2 field3=value3 ... etc
My input, filter and output in my logstash config are like this:
input { file { path => [ "/var/log/fortigate/file.log" ] start_position => "beginning" type =>"firewall" } } filter { if [type] == "firewall" { mutate { gsub => ["message","\"\"","NULL", "message","\"","", "message"," "," "] } grok { match => { "message" => "%{DATA:month} %{NUMBER:day} %{TIME:timestamp} %{IP:ip} %{GREEDYDATA:rest}" } } kv { source => "rest" value_split => "=" field_split => " " remove_field => [ "rest" ] } } } output { if [type] == "firewall" { elasticsearch { hosts => ["x.x.x.20:9200","x.x.x.21:9200"] index => "fortinet-%{+YYYY.MM.dd}" } } }
When I go to kibana to generate the index it does not appear to me, however when I remove the kv filter the index appears to be generated. There are plenty of fields that have the log. What I want is to separate the fields from the log.
I noticed for example that i have the next field: devtype = Android Phone, that can cause the kv filter to fall because of the space?
There are several fields that must be disaggregated, that can generate some problem? the fields are these:
- logver=56
- timestamp=1560396270
- tz=UTC-4
- devname=FGT-HA
- devid=TEXT
- vd=TEXT
- date=2019-06-13
- time=00:24:30
- logid=NUMBER
- type=traffic
- subtype=forward
- level=notice
- eventtime=1560396270
- srcip=IP
- srcport=PORT
- srcintf=TEXT
- srcintfrole=TEXT
- dstip=IP
- dstport=PORT
- dstintf=TEXT
- dstintfrole=wan
- poluuid=TEXT
- sessionid=NUMBER
- proto=6
- action=client-rst
- policyid=50
- policytype=policy
- service=HTTPS
- dstcountry=Chile
- srccountry=Reserved
- trandisp=noop
- appcat=unknown
- applist=TEXT
- duration=106
- sentbyte=NUMBER
- rcvdbyte=NUMBER
- sentpkt=14
- shaperperipname=TEXT
- shaperperipdropbyte=0
- devtype=Android Phone
- osname=Android
- osversion=4.4.2
- mastersrcmac=MAC
- srcmac=MAC
- srcserver=0
If you can guide me on how I can disaggregate the fields I would be very grateful