2026/03/05
2025/11/07
2025/11/04
graylog 7 昨天發布
比較大的改變是不再使用 opensearch 而改用 graylog-datanode
照著官方文件安裝沒什麼問題
如果是在PVE上安裝
因為 mongodb 必須使用到cpu的 avx 功能
所以cpu type 至少要選 x86-64-v3 以上
這個在graylog 5 安裝時就有這個要求了
特別要注意的是以下流程跟之前不同
安裝完後必須 cat /var/log/graylog-server/server.log
找到首次進入系統的帳號密碼及連結
如下範例
http://admin:ghWgeIAkKl@10.0.0.1:9000按照畫面上的流程步驟 使用預設值一直下一步即可
目前先把netflow轉到新版了 觀察一陣子看看
https://go2docs.graylog.org/current/setting_up_graylog/web_interface.htm#Prefligh
https://go2docs.graylog.org/current/downloading_and_installing_graylog/red_hat_installation.htm
2024/11/06
2024/09/19
2024/05/09
2023/12/23
2023/11/01
2023/10/14
最近nas因為更新發生nfs不能使用的問題
因此暫時把graylog搬到其他台還沒更新的nas上
搬完後發現ES變成red
下指令看一下是那些shards
curl -XGET localhost:9200/_cat/shards|grep UNASSIGNED
index.action 0 r UNASSIGNED
index.do 0 r UNASSIGNED
index.aspx 0 r UNASSIGNED
graylog_159 2 p UNASSIGNED
index.htm 0 r UNASSIGNED
index.py 0 r UNASSIGNED
index.php 0 r UNASSIGNED
index.cgi 0 r UNASSIGNED
index.html 0 r UNASSIGNED
index.cfm 0 r UNASSIGNED
index.pl 0 r UNASSIGNED
index.jsp 0 r UNASSIGNED
index.asp 0 r UNASSIGNED
2023/05/05
一直以來都會定時去 graylog 撈 資料
會使用到多個 OR 的下法
accept AND ( 192.168.33.238 OR 192.168.34.215 OR 192.168.33.43 OR 192.168.34.142 OR 192.168.54.247 OR 192.168.7.253 OR 192.168.26.237 OR 192.168.26.228 OR 192.168.25.211 OR 192.168.25.206 OR 192.168.25.117 OR 192.168.26.104 OR 192.168.25.183 OR 192.168.31.241 OR 192.168.30.112 OR 192.168.30.80 OR 192.168.29.6 OR 192.168.29.3 OR 192.168.30.60 OR 192.168.30.58 OR 192.168.29.143 OR 192.168.30.57 OR 192.168.29.223 OR 192.168.29.164 OR 192.168.29.84 OR 192.168.30.200 OR 192.168.30.32 OR 192.168.29.29 OR 192.168.29.199 OR 192.168.29.205 OR 192.168.29.210 OR 192.168.29.200 OR 192.168.29.234 OR 192.168.30.220 OR 192.168.30.194 OR 192.168.29.83 OR 192.168.29.4 OR 192.168.30.108 OR 192.168.29.177 OR 192.168.29.107 OR 192.168.29.32 OR 192.168.30.33 OR 192.168.30.173 OR 192.168.30.247 OR 192.168.30.122 OR 192.168.30.55 OR 192.168.29.19 OR 192.168.29.10 OR 192.168.30.123 OR 192.168.30.201 OR 192.168.29.253 OR 192.168.30.85 OR 192.168.29.48 OR 192.168.30.37 OR 192.168.30.66 OR 192.168.9.100 OR 192.168.30.163 OR 192.168.30.114 OR 192.168.30.59 OR 192.168.30.199 OR 192.168.30.227 OR 192.168.30.41 OR 192.168.29.246 OR 192.168.29.161 OR 192.168.74.248 OR 192.168.74.12 OR 192.168.10.111 OR 192.168.10.104 OR 192.168.50.154 OR 192.168.52.1 OR 192.168.52.3 OR 192.168.50.243 OR 192.168.50.220 OR 192.168.50.179 OR 192.168.50.99 OR 192.168.50.138 OR 192.168.50.98 OR 192.168.50.182 OR 192.168.50.206 OR 192.168.50.234 )
但今天使用同樣的語法
While retrieving data for this widget, the following error(s) occurred:
OpenSearch exception [type=too_many_nested_clauses, reason=Query contains too many nested clauses; maxClauseCount is set to 1024].
問了bing
要修改 /etc/opensearch/opensearch.yml
加上
indices.query.bool.max_clause_count: 10240
2023/04/20
2023/02/11
2020/11/06
最近有人問到 elasticsearch 備分還原的問題
做個記錄
由於 elasticsearch 安裝完成後預設只能本几連線
所以/etc/elasticsearch/elasticsearch.yml
最後加上
network.host: 0.0.0.0
允許本几以外的連線
加完後elasticsearch要重啟才會生效
接下來在目的机上停止 graylog
systemctl stop graylog-server
curl -XGET 'http://localhost:9200/_cat/indices'
依需求在目的几上建立indeces
curl -X PUT "localhost:9200/graylog_514?pretty"
加完後就可以使用 esm 直接複制 indices 順序從小到大
./esm -s http://10.0.0.247:9200 -d http://10.0.0.234:9200 -x graylog_514 -y graylog_514
如果想要備份後再還原 則使用以下指令
備份
./esm -s http://10.0.0.247:9200 -x graylog_455 -o dump.json
還原
./esm -i dump.json -d http://10.0.0.234:9200 -y graylog_455
處理完成後 start graylog
systemctl start graylog-server
要 recalculate index ranges
Indices & Index Sets - Default index set - recalculate index ranges
以上的做法不會更動原資料的時間序
https://github.com/medcl/esm
https://elasticsearch.cn/article/13773
https://community.graylog.org/t/after-data-recovery-not-seeing-data-in-search/13423
2020/01/08
gryalog 的 extractor
suricata
%{WORD:source} %{WORD:UNWANTED}\[%{DATA:UNWANTED}\]: \[%{DATA:suricata_sig_id}\] %{DATA:suricata_msg} \[Classification\: %{DATA:suricata_classification}\] \[Priority\: %{DATA:suricata_priority}\] \{%{DATA:protocol}\} %{IPV4:src_ip}\:%{DATA:srcport} \-\> %{IPV4:dst_ip}\:%{DATA:dstport}$
snort
\[%{DATA:snort_sig_id}\] %{DATA:snort_msg} \[Classification\: %{DATA:snort_classification}\] \[Priority\: %{DATA:snort_priority}\] \{%{DATA:protocol}\} %{IPV4:src_ip}\:%{DATA:srcport} \-\> %{IPV4:dst_ip}\:%{DATA:dstport}$
2019/10/25
但是在vmware的環境中
設完chrony對時
還是一直會出現秒差
只能去修改參數
stable_master_timeout = 60000
預設值為2000 就是 2秒
目前先改為60秒 再觀察看看
重啟graylog
後來想起來 vmware一直有時間不準的問題
想不到到現在還沒改善
2019/10/22
目前我在index set的設定是留180天
超過的delete
不過我會手動去close index
只留約一個月的資料 查詢效率比較好
可是今天發現index超過了180天但系統並沒有去delete
我不確定是不是因為我手動去close的關係
如果真的是如此的話 那政策就要改成定時close
然後再手動去delete了
手動砍的shell如下
每天找出最舊的index再砍掉
#!/bin/bash
del_idx=`/usr/bin/curl -u admin:password 'http://127.0.0.1:9200/_cat/indices/graylog*?v'|grep close|awk '{print $2}'|sort -rn -t_ -k 2|tail -n 1`
/usr/bin/curl -XDELETE "http://localhost:9200/$del_idx/"
用crontab 來做吧
2019/09/18
有人把graylog的index在沒有close情況下砍光了
然後出現了
graylog_deflector這個index
砍了又會自動生出來
然後資料也進不去
本來想說再建一個indexset然後改成default再把原來的砍了
但 不行
找了半天
處理方法如下
Stop all Graylog nodes
(OPTIONAL) If you want to keep the already ingested messages, reindex them into the Elasticsearch index with the greatest number, e. g. graylog_23 if you want to fix the deflector graylog_deflector, via the Elasticsearch Reindex API.
Delete the graylog_deflector index via the Elasticsearch Delete Index API.
curl -u user:passwd -XDELETE http://10.0.0.0:9200/graylog_1
Start the Graylog master node.
Manually rotate the active write index of the index set on the System / Indices / Index Set page in the Maintenance dropdown menu.
(OPTIONAL) Start all remaining Graylog slave nodes.
https://community.graylog.org/t/graylog-error/10800
http://docs.graylog.org/en/3.0/pages/faq.html#how-do-i-fix-the-deflector-exists-as-an-index-and-is-not-an-alias-error-message
目前正常
觀察中
2019/09/07
說本來可以正常運作
但改完ip後
就收不到資料了
連進去看之後先df看了一下 發現HD的使用率很高
然後ES的log出現以下的訊息
[INFO ][cluster.routing.allocation.decider] [Milan] low disk watermark [15%] exceeded on [DZqnmWIZRpapZY_TPkkMBw][Milan] free: 58.6gb[12.6%], replicas will not be assigned to this node
curl -u admin:password -XDELETE http://10.1.2.3:9200/graylog_0
再關掉index
curl -u admin:password -XPOST 'http://10.1.2.3:9200/graylog_4/_close'
以下是列出所有index的指令
curl -u admin:password 'http://10.1.2.3:9200/_cat/indices/graylog*?v'
所以關掉一個後就正常了
curl -u admin:password -XPOST 'http://10.1.2.3:9200/graylog_5/_close'
