{"id":9852,"date":"2024-03-30T23:01:06","date_gmt":"2024-03-30T20:01:06","guid":{"rendered":"https:\/\/sunucun.com.tr\/bilgi\/?post_type=dt_articles&#038;p=9852"},"modified":"2026-11-10T19:38:39","modified_gmt":"2026-11-10T16:38:39","slug":"fail2ban-loglari-nasil-okunur","status":"publish","type":"post","link":"https:\/\/sunucun.com.tr\/blog\/fail2ban-loglari-nasil-okunur\/","title":{"rendered":"Fail2Ban Loglar\u0131 Nas\u0131l Okunur? Ban Kay\u0131tlar\u0131, Durum Komutlar\u0131 ve Unban"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Fail2Ban<\/strong>, sunucu kay\u0131tlar\u0131nda (\u00f6r. SSH giri\u015f denemeleri) \u015f\u00fcpheli tekrarlar\u0131 bulup ilgili IP adresini g\u00fcvenlik duvar\u0131yla ge\u00e7ici olarak engelleyen bir ara\u00e7t\u0131r. Ne zaman, hangi kural (jail) ile ve hangi IP&#8217;yi engelledi\u011fini kendi <strong>log dosyas\u0131na<\/strong> yazar. Bu kay\u0131tlar\u0131 okumak; sald\u0131r\u0131lar\u0131 g\u00f6rmek, yanl\u0131\u015fl\u0131kla engellenen bir IP&#8217;yi bulmak ve kurallar\u0131n \u00e7al\u0131\u015ft\u0131\u011f\u0131n\u0131 do\u011frulamak i\u00e7in gereklidir.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Fail2Ban Log Dosyas\u0131 Nerede?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u00c7o\u011fu da\u011f\u0131t\u0131mda (Debian, Ubuntu ve CentOS\/AlmaLinux paketleri) varsay\u0131lan konum <code>\/var\/log\/fail2ban.log<\/code> dosyas\u0131d\u0131r. Konum, <code>\/etc\/fail2ban\/fail2ban.conf<\/code> i\u00e7indeki <code>logtarget<\/code> ayar\u0131yla belirlenir; de\u011fi\u015ftirmek isterseniz bu dosyay\u0131 d\u00fczenlemek yerine <code>\/etc\/fail2ban\/fail2ban.local<\/code> dosyas\u0131 olu\u015fturup ayar\u0131 oraya yaz\u0131n. Kay\u0131t sistem g\u00fcnl\u00fc\u011f\u00fcne (journal) y\u00f6nlendirilmi\u015fse <code>journalctl -u fail2ban<\/code> komutuyla okunur.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Son 50 sat\u0131r\nsudo tail -n 50 \/var\/log\/fail2ban.log\n\n# Canl\u0131 izleme\nsudo tail -f \/var\/log\/fail2ban.log\n\n# systemd g\u00fcnl\u00fc\u011f\u00fcnden\nsudo journalctl -u fail2ban --since today<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Log Sat\u0131rlar\u0131 Ne Anlama Gelir?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Tipik bir kay\u0131t \u015f\u00f6yle g\u00f6r\u00fcn\u00fcr:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>2026-11-10 14:02:11,384 fail2ban.filter  [812]: INFO    [sshd] Found 203.0.113.25 - 2026-11-10 14:02:11\n2026-11-10 14:02:15,901 fail2ban.actions [812]: NOTICE  [sshd] Ban 203.0.113.25\n2026-11-10 14:12:15,477 fail2ban.actions [812]: NOTICE  [sshd] Unban 203.0.113.25<\/code><\/pre>\n\n\n\n<div class=\"snc-table-wrap\"><table>\n<thead><tr><th>B\u00f6l\u00fcm<\/th><th>Anlam\u0131<\/th><\/tr><\/thead>\n<tbody>\n<tr><td>Tarih ve saat<\/td><td>Olay\u0131n zaman\u0131<\/td><\/tr>\n<tr><td><code>fail2ban.filter<\/code> \/ <code>fail2ban.actions<\/code><\/td><td>Kayd\u0131 yazan bile\u015fen: filtre e\u015fle\u015fme bulur, actions engeller veya engeli kald\u0131r\u0131r<\/td><\/tr>\n<tr><td><code>[812]<\/code><\/td><td>Fail2Ban s\u00fcrecinin numaras\u0131 (PID)<\/td><\/tr>\n<tr><td><code>INFO<\/code>, <code>NOTICE<\/code>, <code>WARNING<\/code>, <code>ERROR<\/code><\/td><td>Kay\u0131t seviyesi<\/td><\/tr>\n<tr><td><code>[sshd]<\/code><\/td><td>Olay\u0131 tetikleyen jail (kural seti)<\/td><\/tr>\n<tr><td><code>Found<\/code><\/td><td>Filtre, IP i\u00e7in \u015f\u00fcpheli bir sat\u0131r buldu (hen\u00fcz engel yok)<\/td><\/tr>\n<tr><td><code>Ban<\/code><\/td><td>IP, <code>findtime<\/code> s\u00fcresi i\u00e7inde <code>maxretry<\/code> say\u0131s\u0131na ula\u015ft\u0131 ve engellendi<\/td><\/tr>\n<tr><td><code>Unban<\/code><\/td><td><code>bantime<\/code> doldu, engel kald\u0131r\u0131ld\u0131<\/td><\/tr>\n<tr><td><code>already banned<\/code><\/td><td>Zaten engelli olan IP yeniden e\u015fle\u015fti<\/td><\/tr>\n<\/tbody><\/table><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Faydal\u0131 Arama Komutlar\u0131<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># Sadece engelleme kay\u0131tlar\u0131\nsudo grep \" Ban \" \/var\/log\/fail2ban.log\n\n# En \u00e7ok engellenen 10 IP\nsudo grep \" Ban \" \/var\/log\/fail2ban.log | awk '{print $NF}' | sort | uniq -c | sort -rn | head\n\n# Belirli bir IP'nin ge\u00e7mi\u015fi\nsudo grep \"203.0.113.25\" \/var\/log\/fail2ban.log\n\n# D\u00f6nd\u00fcr\u00fclm\u00fc\u015f (s\u0131k\u0131\u015ft\u0131r\u0131lm\u0131\u015f) eski loglarda arama\nsudo zgrep \" Ban \" \/var\/log\/fail2ban.log*\n\n# Hata ve uyar\u0131lar\nsudo grep -E \"ERROR|WARNING\" \/var\/log\/fail2ban.log<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Engellenen IP&#8217;leri G\u00f6rmek: fail2ban-client status<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Log dosyas\u0131 ge\u00e7mi\u015fi g\u00f6sterir; o an engelli olan IP&#8217;leri g\u00f6rmek i\u00e7in <code>fail2ban-client<\/code> kullan\u0131l\u0131r:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Aktif jail listesi\nsudo fail2ban-client status\n\n# sshd jail'inin durumu: \u015fu an engelli say\u0131s\u0131, toplam engel ve IP listesi\nsudo fail2ban-client status sshd\n\n# Bir IP'nin engelini kald\u0131rma\nsudo fail2ban-client set sshd unbanip 203.0.113.25<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>status sshd<\/code> \u00e7\u0131kt\u0131s\u0131ndaki <strong>Currently failed<\/strong> e\u015fle\u015fme say\u0131s\u0131n\u0131, <strong>Currently banned<\/strong> o an engelli IP say\u0131s\u0131n\u0131, <strong>Banned IP list<\/strong> ise engelli adresleri g\u00f6sterir. <strong>File list<\/strong> sat\u0131r\u0131, jail&#8217;in hangi log dosyas\u0131n\u0131 izledi\u011fini g\u00f6sterir; burada bekledi\u011finiz dosya yoksa jail hi\u00e7bir \u015fey yakalamaz.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Logda Ne Aramal\u0131?<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Hi\u00e7 Ban yoksa:<\/strong> jail etkin mi (<code>fail2ban-client status<\/code>), izlenen log yolu do\u011fru mu, filtre ger\u00e7ekten sat\u0131rlarla e\u015fle\u015fiyor mu kontrol edin. Filtreyi denemek i\u00e7in: <code>fail2ban-regex \/var\/log\/auth.log \/etc\/fail2ban\/filter.d\/sshd.conf<\/code>.<\/li>\n<li><strong>Kendi IP&#8217;niz engellendiyse:<\/strong> <code>unbanip<\/code> ile kald\u0131r\u0131n ve IP&#8217;nizi <code>ignoreip<\/code> listesine ekleyin.<\/li>\n<li><strong>Ayn\u0131 IP s\u00fcrekli geri geliyorsa:<\/strong> <code>bantime<\/code> s\u00fcresini uzatmay\u0131 veya tekrar edenlere artan s\u00fcre uygulayan <code>bantime.increment<\/code> se\u00e7ene\u011fini de\u011ferlendirin.<\/li>\n<li><strong>ERROR sat\u0131rlar\u0131:<\/strong> genellikle g\u00fcvenlik duvar\u0131 komutunun (iptables, nftables, firewalld) \u00e7al\u0131\u015fmad\u0131\u011f\u0131n\u0131 veya log dosyas\u0131n\u0131n bulunamad\u0131\u011f\u0131n\u0131 g\u00f6sterir.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Kurulum ve temel ayarlar i\u00e7in <a href=\"https:\/\/sunucun.com.tr\/blog\/fail2ban-kurulumu-nasil-yapilir\/\">Fail2Ban kurulumu<\/a> ve <a href=\"https:\/\/sunucun.com.tr\/blog\/fail2ban-ayarlari-nasil-yapilir\/\">Fail2Ban ayarlar\u0131<\/a>, hangi sald\u0131r\u0131lara kar\u015f\u0131 korudu\u011fu i\u00e7in <a href=\"https:\/\/sunucun.com.tr\/blog\/fail2ban-hangi-saldirilari-engeller\/\">Fail2Ban hangi sald\u0131r\u0131lar\u0131 engeller<\/a> yaz\u0131lar\u0131m\u0131za bakabilirsiniz. Root eri\u015fimli bir sunucuda Fail2Ban kurmak i\u00e7in <a href=\"https:\/\/sunucun.com.tr\/vds-sunucu\">VDS sunucular\u0131m\u0131z\u0131<\/a> inceleyebilirsiniz.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">S\u0131k Sorulan Sorular<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Fail2Ban logu ile auth.log aras\u0131ndaki fark nedir?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>auth.log<\/code> (RHEL tabanl\u0131 sistemlerde <code>\/var\/log\/secure<\/code>) SSH giri\u015f denemelerinin kendisini, <code>fail2ban.log<\/code> ise Fail2Ban&#8217;\u0131n bu denemelere verdi\u011fi tepkiyi (Found, Ban, Unban) kaydeder.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Log dosyas\u0131 \u00e7ok b\u00fcy\u00fcd\u00fc, silebilir miyim?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Dosyay\u0131 elle silmek yerine logrotate ile d\u00f6nd\u00fcr\u00fclmesini sa\u011flay\u0131n; paketler genellikle bunun i\u00e7in bir logrotate ayar\u0131yla gelir. Eski dosyalar <code>.1<\/code>, <code>.2.gz<\/code> gibi uzant\u0131larla saklan\u0131r.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fail2Ban, sunucu kay\u0131tlar\u0131nda (\u00f6r. SSH giri\u015f denemeleri) \u015f\u00fcpheli tekrarlar\u0131 bulup ilgili IP adresini g\u00fcvenlik duvar\u0131yla ge\u00e7ici olarak engelleyen bir ara\u00e7t\u0131r. Ne zaman, hangi kural (jail) ile ve hangi IP&#8217;yi engelledi\u011fini kendi log dosyas\u0131na yazar. Bu kay\u0131tlar\u0131 okumak; sald\u0131r\u0131lar\u0131 g\u00f6rmek, yanl\u0131\u015fl\u0131kla engellenen bir IP&#8217;yi bulmak ve kurallar\u0131n \u00e7al\u0131\u015ft\u0131\u011f\u0131n\u0131 do\u011frulamak i\u00e7in gereklidir. Fail2Ban Log Dosyas\u0131 Nerede? \u00c7o\u011fu&hellip;<\/p>\n","protected":false},"author":1,"featured_media":9853,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[1519],"tags":[],"class_list":["post-9852","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sanal-sunucu"],"_links":{"self":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/posts\/9852","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/comments?post=9852"}],"version-history":[{"count":1,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/posts\/9852\/revisions"}],"predecessor-version":[{"id":19917,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/posts\/9852\/revisions\/19917"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/media\/9853"}],"wp:attachment":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/media?parent=9852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/categories?post=9852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/tags?post=9852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}