• 一、 环境描述
  • 二、 软件准备
  • cd /etc/apt/
  • mv sources.list sources.list-
  • vim sources.list
  • cat sources.list
  • https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse">deb https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
  • https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse">deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
  • http://loc>
    Aug 13 02:10:46 elas logstash[270442]: [2021-08-13T02:10:46,798][INFO ][logstash.outputs.elasticsearch][main] ES Output version determined {:esversion=>7}
    Aug 13 02:10:46 elas logstash[270442]: [2021-08-13T02:10:46,802][WARN ][logstash.outputs.elasticsearch][main] Detected a 6.x and above cluster: the type event fi>
    Aug 13 02:10:46 elas logstash[270442]: [2021-08-13T02:10:46,857][INFO ][logstash.outputs.elasticsearch][main] New Elasticsearch output {:class=>”LogStash::Outputs:>
    Aug 13 02:10:47 elas logstash[270442]: [2021-08-13T02:10:47,110][INFO ][logstash.javapipeline ][main] Starting pipeline {:pipeline_id=>”main”, “pipeline.workers>
    Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,070][INFO ][logstash.javapipeline ][main] Pipeline Java execution initialization time {“seconds”=>0.>
    Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,325][INFO ][logstash.inputs.file ][main] No sincedb_path set, generating one based on the “path” se>
    Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,352][INFO ][logstash.javapipeline ][main] Pipeline started {“pipeline.id”=>”main”}
    Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,409][INFO ][filewatch.observingtail ][main][6efc126c2ab1b0e66a90b494d9a18ae7dc55003ac5f9addc874a5130d9>
    Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,417][INFO ][logstash.agent ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non
    >

    3、 kibana配置
    # cd /etc/kibana/
    # vim kibana.yml
    image.png
    # systemctl daemon-reload
    重启服务;
    # systemctl restart kibana.service
    查看服务状态;
    # systemctl status kibana.service
    ● kibana.service - Kibana
    Loaded: loaded (/etc/systemd/system/kibana.service; enabled; vendor preset: enabled)
    Active: active (running) since Fri 2021-08-13 02:19:08 UTC; 5h 16min ago
    Docs: https://www.elastic.co
    Main PID: 270722 (node)
    Tasks: 11 (limit: 19109)
    Memory: 267.2M
    CGroup: /system.slice/kibana.service
    └─270722 /usr/share/kibana/bin/../node/bin/node /usr/share/kibana/bin/../src/cli/dist —logging.dest=/var/log/kibana/kibana.log —pid.file=/run/kibana>

    Aug 13 02:19:08 elas systemd[1]: Started Kibana.

    查看服务监听端口
    # netstat -tlunp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 127.0.0.53:53 0.0.0.0: LISTEN 661/systemd-resolve
    tcp 0 0 0.0.0.0:22 0.0.0.0:
    LISTEN 780/sshd: /usr/sbin
    tcp 0 0 127.0.0.1:6010 0.0.0.0: LISTEN 265188/sshd: root@p
    tcp 0 0 0.0.0.0:5601 0.0.0.0:
    LISTEN 270722/node
    tcp6 0 0 :::9300 ::: LISTEN 271265/java
    tcp6 0 0 :::22 :::
    LISTEN 780/sshd: /usr/sbin
    tcp6 0 0 ::1:6010 ::: LISTEN 265188/sshd: root@p
    tcp6 0 0 127.0.0.1:9600 :::
    LISTEN 270442/java
    tcp6 0 0 :::9200 ::: LISTEN 271265/java
    udp 0 0 127.0.0.53:53 0.0.0.0:
    661/systemd-resolve">systemctl daemon-reload
    重启服务
    # systemctl restart logstash.service
    查看服务器状态
    # systemctl status logstash.service
    ● logstash.service - logstash
    Loaded: loaded (/etc/systemd/system/logstash.service; enabled; vendor preset: enabled)
    Active: active (running) since Fri 2021-08-13 02:10:24 UTC; 5h 17min ago
    Main PID: 270442 (java)
    Tasks: 72 (limit: 19109)
    Memory: 2.6G
    CGroup: /system.slice/logstash.service
    └─270442 /usr/share/logstash/jdk/bin/java -Xms2g -Xmx2g -XX:+UseG1GC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Djava.a>

    Aug 13 02:10:46 elas logstash[270442]: [2021-08-13T02:10:46,739][WARN ][logstash.outputs.elasticsearch][main] Restored connection to ES instance {:url=>”http://loc>
    Aug 13 02:10:46 elas logstash[270442]: [2021-08-13T02:10:46,798][INFO ][logstash.outputs.elasticsearch][main] ES Output version determined {:esversion=>7}
    Aug 13 02:10:46 elas logstash[270442]: [2021-08-13T02:10:46,802][WARN ][logstash.outputs.elasticsearch][main] Detected a 6.x and above cluster: the type event fi>
    Aug 13 02:10:46 elas logstash[270442]: [2021-08-13T02:10:46,857][INFO ][logstash.outputs.elasticsearch][main] New Elasticsearch output {:class=>”LogStash::Outputs:>
    Aug 13 02:10:47 elas logstash[270442]: [2021-08-13T02:10:47,110][INFO ][logstash.javapipeline ][main] Starting pipeline {:pipeline_id=>”main”, “pipeline.workers>
    Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,070][INFO ][logstash.javapipeline ][main] Pipeline Java execution initialization time {“seconds”=>0.>
    Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,325][INFO ][logstash.inputs.file ][main] No sincedb_path set, generating one based on the “path” se>
    Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,352][INFO ][logstash.javapipeline ][main] Pipeline started {“pipeline.id”=>”main”}
    Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,409][INFO ][filewatch.observingtail ][main][6efc126c2ab1b0e66a90b494d9a18ae7dc55003ac5f9addc874a5130d9>
    Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,417][INFO ][logstash.agent ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non
    >

    3、 kibana配置
    # cd /etc/kibana/
    # vim kibana.yml
    image.png
    # systemctl daemon-reload
    重启服务;
    # systemctl restart kibana.service
    查看服务状态;
    # systemctl status kibana.service
    ● kibana.service - Kibana
    Loaded: loaded (/etc/systemd/system/kibana.service; enabled; vendor preset: enabled)
    Active: active (running) since Fri 2021-08-13 02:19:08 UTC; 5h 16min ago
    Docs: https://www.elastic.co
    Main PID: 270722 (node)
    Tasks: 11 (limit: 19109)
    Memory: 267.2M
    CGroup: /system.slice/kibana.service
    └─270722 /usr/share/kibana/bin/../node/bin/node /usr/share/kibana/bin/../src/cli/dist —logging.dest=/var/log/kibana/kibana.log —pid.file=/run/kibana>

    Aug 13 02:19:08 elas systemd[1]: Started Kibana.

    查看服务监听端口
    # netstat -tlunp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 127.0.0.53:53 0.0.0.0: LISTEN 661/systemd-resolve
    tcp 0 0 0.0.0.0:22 0.0.0.0:
    LISTEN 780/sshd: /usr/sbin
    tcp 0 0 127.0.0.1:6010 0.0.0.0: LISTEN 265188/sshd: root@p
    tcp 0 0 0.0.0.0:5601 0.0.0.0:
    LISTEN 270722/node
    tcp6 0 0 :::9300 ::: LISTEN 271265/java
    tcp6 0 0 :::22 :::
    LISTEN 780/sshd: /usr/sbin
    tcp6 0 0 ::1:6010 ::: LISTEN 265188/sshd: root@p
    tcp6 0 0 127.0.0.1:9600 :::
    LISTEN 270442/java
    tcp6 0 0 :::9200 ::: LISTEN 271265/java
    udp 0 0 127.0.0.53:53 0.0.0.0:
    661/systemd-resolve

一、 环境描述

系统版本:Ubuntu20.04.2LTS
Tshark:thark_3.2.3-1
Logstash:logstash-7.12.0-amd64.deb
Elasticsearch:elasticsearch-7.12.0-amd64.deb
Kibana:kibana-7.12.0-amd64.deb

系统结构图参考:
image.png

二、 软件准备

  1. 下载logstash;
    # wget https://artifacts.elastic.co/downloads/logstash/logstash-7.12.0-amd64.deb
    2. 下载elasticsearch;
    # wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.0-amd64.deb
    3. 下载kibana;
    # wget https://artifacts.elastic.co/downloads/kibana/kibana-7.12.0-amd64.deb
    4. 下载tsharkVM git包(主要用到里面一个处理脚本);
    # git clone https://github.com/H21lab/tsharkVM.git
    5. 修改Ubuntu的source源为国内镜像源; ```bash

    cd /etc/apt/

    mv sources.list sources.list-

    vim sources.list

    cat sources.list

    deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse

Not recommended

deb https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse

deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse

  1. 6. 更新系统;<br /># apt update && apt upgrade && reboot
  2. <a name="oA2Fz"></a>
  3. ## 三、 软件安装
  4. 1 安装tsharkjava
  5. ```bash
  6. # apt install tshark
  7. The following packages were automatically installed and are no longer required:
  8. eatmydata libeatmydata1 python3-importlib-metadata python3-jinja2 python3-json-pointer python3-jsonpatch python3-jsonschema python3-markupsafe
  9. python3-more-itertools python3-pyrsistent python3-zipp
  10. Use 'apt autoremove' to remove them.
  11. The following additional packages will be installed:
  12. libc-ares2 libjbig0 libjpeg-turbo8 libjpeg8 liblua5.2-0 libsbc1 libsmi2ldbl libsnappy1v5 libspandsp2 libspeexdsp1 libssh-gcrypt-4 libtiff5
  13. libwebp6 libwireshark-data libwireshark13 libwiretap10 libwsutil11 wireshark-common
  14. Suggested packages:
  15. snmp-mibs-downloader geoipupdate geoip-database geoip-database-extra libjs-leaflet libjs-leaflet.markercluster wireshark-doc
  16. The following NEW packages will be installed:
  17. libc-ares2 libjbig0 libjpeg-turbo8 libjpeg8 liblua5.2-0 libsbc1 libsmi2ldbl libsnappy1v5 libspandsp2 libspeexdsp1 libssh-gcrypt-4 libtiff5
  18. libwebp6 libwireshark-data libwireshark13 libwiretap10 libwsutil11 tshark wireshark-common
  19. 0 upgraded, 19 newly installed, 0 to remove and 0 not upgraded.
  20. Need to get 18.8 MB of archives.
  21. After this operation, 109 MB of additional disk space will be used.
  22. Do you want to continue? [Y/n] y
  23. # apt install openjdk-11-jre-headless
  24. The following packages were automatically installed and are no longer required:
  25. eatmydata libeatmydata1 python3-importlib-metadata python3-jinja2 python3-json-pointer python3-jsonpatch python3-jsonschema python3-markupsafe
  26. python3-more-itertools python3-pyrsistent python3-zipp
  27. Use 'apt autoremove' to remove them.
  28. The following additional packages will be installed:
  29. ca-certificates-java fontconfig-config fonts-dejavu-core java-common libavahi-client3 libavahi-common-data libavahi-common3 libcups2
  30. libfontconfig1 libgraphite2-3 libharfbuzz0b liblcms2-2 libpcsclite1
  31. Suggested packages:
  32. default-jre cups-common liblcms2-utils pcscd libnss-mdns fonts-dejavu-extra fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei
  33. | fonts-wqy-zenhei fonts-indic
  34. The following NEW packages will be installed:
  35. ca-certificates-java fontconfig-config fonts-dejavu-core java-common libavahi-client3 libavahi-common-data libavahi-common3 libcups2
  36. libfontconfig1 libgraphite2-3 libharfbuzz0b liblcms2-2 libpcsclite1 openjdk-11-jre-headless
  37. 0 upgraded, 14 newly installed, 0 to remove and 0 not upgraded.
  38. Need to get 39.4 MB of archives.
  39. After this operation, 177 MB of additional disk space will be used.
  40. Do you want to continue? [Y/n] y


2、 安装ELK

  1. # dpkg -i elasticsearch-7.12.0-amd64.deb kibana-7.12.0-amd64.deb logstash-7.12.0-amd64.deb
  2. Preparing to unpack elasticsearch-7.12.0-amd64.deb ...
  3. Creating elasticsearch group... OK
  4. Creating elasticsearch user... OK
  5. Unpacking elasticsearch (7.12.0) ...
  6. Selecting previously unselected package kibana.
  7. Preparing to unpack kibana-7.12.0-amd64.deb ...
  8. Unpacking kibana (7.12.0) ...
  9. Selecting previously unselected package logstash.
  10. Preparing to unpack logstash-7.12.0-amd64.deb ...
  11. Unpacking logstash (1:7.12.0-1) ...
  12. Setting up elasticsearch (7.12.0) ...
  13. Created elasticsearch keystore in /etc/elasticsearch/elasticsearch.keystore
  14. Setting up kibana (7.12.0) ...
  15. Creating kibana group... OK
  16. Creating kibana user... OK
  17. Created Kibana keystore in /etc/kibana/kibana.keystore
  18. Setting up logstash (1:7.12.0-1) ...
  19. Using bundled JDK: /usr/share/logstash/jdk
  20. Using provided startup.options file: /etc/logstash/startup.options
  21. OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
  22. /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/pleaserun-0.0.31/lib/pleaserun/platform/base.rb:112: warning: constant ::Fixnum is deprecated
  23. Successfully created system startup script for Logstash

四、 ELK配置

1、 elasticsearch配置
# cd /etc/elasticsearch/
# vim jvm.options
image.png

# vim elasticsearch.yml
image.png
image.png
# systemctl daemon-reload
重启服务;
# systemctl restart elasticsearch.service
查看服务状态;
# systemctl status elasticsearch.service
●elasticsearch.service - Elasticsearch
Loaded: loaded (/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-08-13 02:55:08 UTC; 4h 7min ago
Docs: https://www.elastic.co
Main PID: 271265 (java)
Tasks: 99 (limit: 19109)
Memory: 8.6G
CGroup: /system.slice/elasticsearch.service
├─271265 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreT>
└─271470 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller

Aug 13 02:54:48 elas systemd[1]: Starting Elasticsearch…
Aug 13 02:55:08 elas systemd[1]: Started Elasticsearch.

查看服务监听端口;
# netstat -tlunp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.53:53 0.0.0.0: LISTEN 661/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:
LISTEN 780/sshd: /usr/sbin
tcp 0 0 127.0.0.1:6010 0.0.0.0: LISTEN 265188/sshd: root@p
tcp 0 0 0.0.0.0:5601 0.0.0.0:
LISTEN 270722/node
tcp6 0 0 :::9300 ::: LISTEN 271265/java
tcp6 0 0 :::22 :::
LISTEN 780/sshd: /usr/sbin
tcp6 0 0 ::1:6010 ::: LISTEN 265188/sshd: root@p
tcp6 0 0 127.0.0.1:9600 :::
LISTEN 270442/java
tcp6 0 0 :::9200 ::: LISTEN 271265/java
udp 0 0 127.0.0.53:53 0.0.0.0:
661/systemd-resolve

2、 logstash配置
# cd /etc/logstash/
# vim jvm.options
image.png
# cd conf.d/
增加tshark数据输入到elasticsearch配置文件;

  1. # vim tshark-elas.conf
  2. # cat tshark-elas.conf
  3. input {
  4. file {
  5. path => "/data/packets.json"
  6. start_position => "beginning"
  7. }
  8. }
  9. filter {
  10. # Drop Elasticsearch Bulk API control lines
  11. if ([message] =~ "{\"index") {
  12. drop {}
  13. }
  14. json {
  15. source => "message"
  16. remove_field => "message"
  17. }
  18. # Extract innermost network protocol
  19. grok {
  20. match => {
  21. "[layers][frame][frame_frame_protocols]" => "%{WORD:protocol}$"
  22. }
  23. }
  24. date {
  25. match => [ "timestamp", "UNIX_MS" ]
  26. }
  27. }
  28. output {
  29. elasticsearch {
  30. hosts => "localhost:9200"
  31. index => "packets-%{+YYYY-MM-dd}"
  32. # document_type => "pcap_file"
  33. manage_template => false
  34. }
  35. }

systemctl daemon-reload
重启服务
# systemctl restart logstash.service
查看服务器状态
# systemctl status logstash.service
● logstash.service - logstash
Loaded: loaded (/etc/systemd/system/logstash.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-08-13 02:10:24 UTC; 5h 17min ago
Main PID: 270442 (java)
Tasks: 72 (limit: 19109)
Memory: 2.6G
CGroup: /system.slice/logstash.service
└─270442 /usr/share/logstash/jdk/bin/java -Xms2g -Xmx2g -XX:+UseG1GC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Djava.a>

Aug 13 02:10:46 elas logstash[270442]: [2021-08-13T02:10:46,739][WARN ][logstash.outputs.elasticsearch][main] Restored connection to ES instance {:url=>”http://loc>
Aug 13 02:10:46 elas logstash[270442]: [2021-08-13T02:10:46,798][INFO ][logstash.outputs.elasticsearch][main] ES Output version determined {:esversion=>7}
Aug 13 02:10:46 elas logstash[270442]: [2021-08-13T02:10:46,802][WARN ][logstash.outputs.elasticsearch][main] Detected a 6.x and above cluster: the type event fi>
Aug 13 02:10:46 elas logstash[270442]: [2021-08-13T02:10:46,857][INFO ][logstash.outputs.elasticsearch][main] New Elasticsearch output {:class=>”LogStash::Outputs:>
Aug 13 02:10:47 elas logstash[270442]: [2021-08-13T02:10:47,110][INFO ][logstash.javapipeline ][main] Starting pipeline {:pipeline_id=>”main”, “pipeline.workers>
Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,070][INFO ][logstash.javapipeline ][main] Pipeline Java execution initialization time {“seconds”=>0.>
Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,325][INFO ][logstash.inputs.file ][main] No sincedb_path set, generating one based on the “path” se>
Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,352][INFO ][logstash.javapipeline ][main] Pipeline started {“pipeline.id”=>”main”}
Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,409][INFO ][filewatch.observingtail ][main][6efc126c2ab1b0e66a90b494d9a18ae7dc55003ac5f9addc874a5130d9>
Aug 13 02:10:48 elas logstash[270442]: [2021-08-13T02:10:48,417][INFO ][logstash.agent ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non
>

3、 kibana配置
# cd /etc/kibana/
# vim kibana.yml
image.png
# systemctl daemon-reload
重启服务;
# systemctl restart kibana.service
查看服务状态;
# systemctl status kibana.service
● kibana.service - Kibana
Loaded: loaded (/etc/systemd/system/kibana.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-08-13 02:19:08 UTC; 5h 16min ago
Docs: https://www.elastic.co
Main PID: 270722 (node)
Tasks: 11 (limit: 19109)
Memory: 267.2M
CGroup: /system.slice/kibana.service
└─270722 /usr/share/kibana/bin/../node/bin/node /usr/share/kibana/bin/../src/cli/dist —logging.dest=/var/log/kibana/kibana.log —pid.file=/run/kibana>

Aug 13 02:19:08 elas systemd[1]: Started Kibana.

查看服务监听端口
# netstat -tlunp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.53:53 0.0.0.0: LISTEN 661/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:
LISTEN 780/sshd: /usr/sbin
tcp 0 0 127.0.0.1:6010 0.0.0.0: LISTEN 265188/sshd: root@p
tcp 0 0 0.0.0.0:5601 0.0.0.0:
LISTEN 270722/node
tcp6 0 0 :::9300 ::: LISTEN 271265/java
tcp6 0 0 :::22 :::
LISTEN 780/sshd: /usr/sbin
tcp6 0 0 ::1:6010 ::: LISTEN 265188/sshd: root@p
tcp6 0 0 127.0.0.1:9600 :::
LISTEN 270442/java
tcp6 0 0 :::9200 ::: LISTEN 271265/java
udp 0 0 127.0.0.53:53 0.0.0.0:
661/systemd-resolve

五、 配置Tshark数据包模板

1、 导出elastic-mapping;
# cd tsharkVM/Kibana
# tshark -G elastic-mapping —elastic-mapping-filter frame,eth,ip,udp,tcp,dns > custom_tshark_mapping.json
2、 处理重复字段和类型;(脚本处理完后,还有一些字段类型不匹配,在logstash导入数据时会有提示,根据提示,修改后再重新导入);
# ruby ./Public/process_tshark_mapping_json.rb
下面是我处理过的mapping文件示例
custom_tshark_mapping_deduplicated.json
3、 导入模板文件;
# curl -X PUT “localhost:9200/_index_template/packets_template” -H ‘Content-Type: application/json’ \
-d@custom_tshark_mapping_deduplicated.json

{“acknowledged”:true}
#

六、 导入数据

1、 使用tshark将数据包转换为elasticsearch格式,由logstacsh输出到elasticsearch;
# tshark –T ek –x –r 1030.pcap > /data/packets.json
2、 在kibana上创建index patterns;
image.png
image.png
image.png
自定义展示;
image.png
image.png
image.png

七、 完成。