Telegram Group & Telegram Channel
🧠 RegExp: Как найти строки с IP-адресами в логах

Частая задача — выцепить IP-адреса из логов. Вот регулярка и однострочник, которые помогут:


grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' /var/log/nginx/access.log


📌 Что делает:
- -Eo — включаем расширенные регулярки и выводим только совпадения
- ([0-9]{1,3}\.){3}[0-9]{1,3} — шаблон для IPv4-адресов

💡 Можно дополнительно убрать дубликаты и отсортировать по частоте:


grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' /var/log/nginx/access.log | sort | uniq -c | sort -nr | head


🚀 Покажет топ IP-адресов по количеству обращений — удобно для анализа трафика и выявления подозрительной активности.



tg-me.com/pro_python_code/1799
Create:
Last Update:

🧠 RegExp: Как найти строки с IP-адресами в логах

Частая задача — выцепить IP-адреса из логов. Вот регулярка и однострочник, которые помогут:


grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' /var/log/nginx/access.log


📌 Что делает:
- -Eo — включаем расширенные регулярки и выводим только совпадения
- ([0-9]{1,3}\.){3}[0-9]{1,3} — шаблон для IPv4-адресов

💡 Можно дополнительно убрать дубликаты и отсортировать по частоте:


grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' /var/log/nginx/access.log | sort | uniq -c | sort -nr | head


🚀 Покажет топ IP-адресов по количеству обращений — удобно для анализа трафика и выявления подозрительной активности.

BY Python RU




Share with your friend now:
tg-me.com/pro_python_code/1799

View MORE
Open in Telegram


Python RU Telegram | DID YOU KNOW?

Date: |

China’s stock markets are some of the largest in the world, with total market capitalization reaching RMB 79 trillion (US$12.2 trillion) in 2020. China’s stock markets are seen as a crucial tool for driving economic growth, in particular for financing the country’s rapidly growing high-tech sectors.Although traditionally closed off to overseas investors, China’s financial markets have gradually been loosening restrictions over the past couple of decades. At the same time, reforms have sought to make it easier for Chinese companies to list on onshore stock exchanges, and new programs have been launched in attempts to lure some of China’s most coveted overseas-listed companies back to the country.

The STAR Market, as is implied by the name, is heavily geared toward smaller innovative tech companies, in particular those engaged in strategically important fields, such as biopharmaceuticals, 5G technology, semiconductors, and new energy. The STAR Market currently has 340 listed securities. The STAR Market is seen as important for China’s high-tech and emerging industries, providing a space for smaller companies to raise capital in China. This is especially significant for technology companies that may be viewed with suspicion on overseas stock exchanges.

Python RU from ru


Telegram Python RU
FROM USA