Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is planing to update for Kibana 5 ? #9

Open
DmitrySboychakov opened this issue Feb 2, 2017 · 23 comments
Open

Is planing to update for Kibana 5 ? #9

DmitrySboychakov opened this issue Feb 2, 2017 · 23 comments

Comments

@DmitrySboychakov
Copy link

No description provided.

@pevma
Copy link
Member

pevma commented Feb 3, 2017

It is planned towards the end of the month - however any feedback on these dashboards import to Kibana 5 is welcome!

@AntonioMeireles
Copy link

AntonioMeireles commented Feb 3, 2017

@pevma FWIW patch bellow to the stock logstash filter (seems to) gets most stuff to work, as is, out of the box under elk (last tested with 5.2.0)

--- logstash.conf.l4	2017-02-03 18:45:24.000000000 +0000
+++ logstash.conf	2017-02-03 18:46:16.000000000 +0000
@@ -11,10 +11,21 @@
       match => [ "timestamp", "ISO8601" ]
     }
     ruby {
-      code => "if event['event_type'] == 'fileinfo'; event['fileinfo']['type']=event['fileinfo']['magic'].to_s.split(',')[0]; end;"
+      code => "
+        if event.get('[event_type]') == 'fileinfo'
+          event.set('[fileinfo][type]', event.get('[fileinfo][magic]').to_s.split(',')[0])
+        end
+      "
     }
     ruby {
-      code => "if event['event_type'] == 'alert'; sp = event['alert']['signature'].to_s.split(' group '); if (sp.length == 2) and /\A\d+\z/.match(sp[1]); event['alert']['signature'] = sp[0] ;end; end;"
+      code => "
+        if event.get('[event_type]') == 'alert'
+          sp = event.get('[alert][signature]').to_s.split(' group ')
+          if (sp.length == 2) and /\A\d+\z/.match(sp[1])
+            event.set('[alert][signature]', sp[0])
+          end
+        end
+      "
     }
 
     metrics {

And thanks && congrats to the whole team for the great work!

@pevma
Copy link
Member

pevma commented Feb 6, 2017

@AntonioMeireles - Thanks a bunch for the feedback ! Very useful!

@mliu1212
Copy link

mliu1212 commented Feb 8, 2017

What is the logstash.config file that you use for these dashboards?
I tried a modified version from https://redmine.openinfosecfoundation.org/projects/suricata/wiki/_Logstash_Kibana_and_Suricata_JSON_output but Kibana (4.6) only seems to find the logstash-* index - I had to change all the visualizations to use that index instead of the other.

I want to upgrade to ELK 5.2 stack, would anyone mind sharing a config file that uses the changes @AntonioMeireles mentioned?

@AntonioMeireles
Copy link

@mliu1212 something along ...

input {
   beats {
     port => 5044
     codec => json
   }
}

filter {
  if [type] == "SELKS" {
    date {
      match => [ "timestamp", "ISO8601" ]
    }
    ruby {
      code => "
        if event.get('[event_type]') == 'fileinfo'
          event.set('[fileinfo][type]', event.get('[fileinfo][magic]').to_s.split(',')[0])
        end
      "
    }
    ruby {
      code => "
        if event.get('[event_type]') == 'alert'
          sp = event.get('[alert][signature]').to_s.split(' group ')
          if (sp.length == 2) and /\A\d+\z/.match(sp[1])
            event.set('[alert][signature]', sp[0])
          end
        end
      "
    }

    metrics {
      meter => [ "eve_insert" ]
      add_tag => "metric"
      flush_interval => 30
    }
  }

  if [http] {
    useragent {
       source => "[http][http_user_agent]"
       target => "[http][user_agent]"
    }
  }

  if [src_ip]  {
    if [src_ip] !~ ":" {
      mutate {
        add_field => [ "[src_ip4]", "%{src_ip}" ]
      }
    }
    geoip {
      source => "src_ip"
      target => "geoip"
      #database => "/opt/logstash/vendor/geoip/GeoLiteCity.dat"
      add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}" ]
      add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}"  ]
    }
    mutate {
      convert => [ "[geoip][coordinates]", "float" ]
    }
    if ![geoip.ip] {
      if [dest_ip]  {
        geoip {
          source => "dest_ip"
          target => "geoip"
          #database => "/opt/logstash/vendor/geoip/GeoLiteCity.dat"
          add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}" ]
          add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}"  ]
        }
        mutate {
          convert => [ "[geoip][coordinates]", "float" ]
        }
      }
    }
  }
  if [dest_ip] {
    if [dest_ip] !~ ":" {
      mutate {
        add_field => [ "[dest_ip4]", "%{dest_ip}" ]
      }
    }
  }
}

output {
  if [event_type] and [event_type] not in ['stats', 'engine'] {
    elasticsearch {
      hosts => elasticsearch
      index => "logstash-%{event_type}-%{+YYYY.MM.dd}"
      #template => "/etc/logstash/elasticsearch-template.json"
    }
  } else {
    elasticsearch {
      hosts => elasticsearch
      index => "logstash-%{+YYYY.MM.dd}"
    }
  }
  # stdout { codec => rubydebug }
  if "metric" in [tags] {
       stdout {
         codec => line {
           format => "EVE insert rate: %{[eve_insert][rate_1m]}"
         }
       }
  }
}

@mliu1212
Copy link

mliu1212 commented Feb 9, 2017

Thanks I will try that out. Quick question - is your input file not coming from suricata eve.json? I noticed you are using beats.

@AntonioMeireles
Copy link

AntonioMeireles commented Feb 9, 2017 via email

@mliu1212
Copy link

mliu1212 commented Feb 9, 2017

Ah so your filebeat configuration has the eve.json as the input, and logstash as the output?

@AntonioMeireles
Copy link

AntonioMeireles commented Feb 9, 2017 via email

@DmitrySboychakov
Copy link
Author

Any news ?

@pevma
Copy link
Member

pevma commented Feb 27, 2017

There is planned work on that this and next week.
@SboichakovDmitriy - willing to participate in some test feedback?

@DmitrySboychakov
Copy link
Author

Yes, sure. You can send out all needed information to my email : [email protected]
Thanks.

@pevma
Copy link
Member

pevma commented Feb 27, 2017

perfect - thanks for the help !

@AntonioMeireles
Copy link

@pevma - can you plz add me to the "beta" too ? (email address is the one in GitHub logs)

@pevma
Copy link
Member

pevma commented Mar 3, 2017

As soon as we have something in test sequence i will let you know guys. Thanks!

@DmitrySboychakov
Copy link
Author

Hey, @pevma, any updates/news for us ?
Maybe we can help with something?
#WaitForKibana5 ;)

@pevma
Copy link
Member

pevma commented Apr 7, 2017

@SboichakovDmitriy @AntonioMeireles and anyone else willing to test and feedback -
https://github.com/StamusNetworks/KTS5
:)

You can use the same logstash config but with the adjustment @AntonioMeireles mentioned above.

@AntonioMeireles
Copy link

AntonioMeireles commented Apr 7, 2017

@pevma THANKS! will get a look && report. btw my logstash config above can be AFAICT trimmed to ...

filter {
  if [type] == "SELKS" {
    date {
      match => [ "timestamp", "ISO8601" ]
    }
    ruby {
      code => "
        if event.get('[event_type]') == 'fileinfo'
          event.set('[fileinfo][type]', event.get('[fileinfo][magic]').to_s.split(',')[0])
        end
      "
    }
    ruby {
      code => "
        if event.get('[event_type]') == 'alert'
          sp = event.get('[alert][signature]').to_s.split(' group ')
          if (sp.length == 2) and /\A\d+\z/.match(sp[1])
            event.set('[alert][signature]', sp[0])
          end
        end
      "
    }

    metrics {
      meter => [ "eve_insert" ]
      add_tag => "metric"
      add_field => { "event_type" => "stats" }
      flush_interval => 30
    }
  }

  if [http] {
    useragent {
       source => "[http][http_user_agent]"
       target => "[http][user_agent]"
    }
  }

  if [src_ip]  {
    if [src_ip] !~ ":" {
      mutate {
        add_field => [ "[src_ip4]", "%{src_ip}" ]
      }
    }
    geoip {
      source => "src_ip"
    }
    if ![geoip.ip] {
      if [dest_ip]  {
        geoip {
          source => "dest_ip"
        }
      }
    }
  }
  if [dest_ip] {
    if [dest_ip] !~ ":" {
      mutate {
        add_field => [ "[dest_ip4]", "%{dest_ip}" ]
      }
    }
  }
}

@pevma
Copy link
Member

pevma commented Apr 23, 2017

FYI -
We did some further updates here - https://github.com/StamusNetworks/KTS5

We also have upgrade procedure ready for testing for SELKS 3 to SELKS 4 upgrades - https://github.com/StamusNetworks/SELKS/wiki/SELKS-3.0-to-SELKS-4.0-upgrades---testing

@AntonioMeireles
Copy link

@pevma Hi!

(sorry lag! && many, many thanks for your hard work)
some notes...

  • kibana-5.3.1 doesn't seem to like at all of spaces in dashboards names. it just can't find them. (5.3.0 is OK)
  • there 's a bug in the load.sh script. -H "Content-Type: application/json" needs to be added to every curl -X{PUT,POST} otherwise one gets a HTTP/406 "Content-Type header [application/x-www-form-urlencoded] is not supported" type of error
  • there's another issue at the botton of the load.shscript. it expects dashboards/config.json to be present (was before) and meanwhile ir went MIA. while on this it probably makes sense to update the hardcoded 4.3.1 in that script to something more dynamic/evolving...

Also, load.sh should probably offer a way to dynamically allow the indices prefix to be set (defaults to logstash-. Otherwise, things work as expected, the way that is expected :-) . To close the circle and make things perfect, only thing missing would be probably some dashboards for netflow data.

@AntonioMeireles
Copy link

@pevma also sed -i "s,\.raw,.keyword,g" dashboards/*/*.json ...

@pevma
Copy link
Member

pevma commented May 17, 2017

@AntonioMeireles - thanks for the input! noted on the errors ...doing some fixing and updating the repo soon.
I tried importing the dashboards through Scirius - had no issue with Kibana 5.4.0 with regards to spaces in the names. wondering though if we should sub the spaces with a "-" or similar?

One problem about substituting the "raw" with "keyword" is that we will loose backwards compatibility I think.

pevma added a commit to StamusNetworks/KTS5 that referenced this issue May 17, 2017
Fixes bugs with regards to curl and config.json as reported in -
StamusNetworks/KTS#9 (comment)
@pevma
Copy link
Member

pevma commented May 17, 2017

@AntonioMeireles - addressed most of the stuff here - https://github.com/StamusNetworks/KTS5/commits/master - master updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants