How to Deploy Zeek and Integrating with Graylog (Zeek+Graylog)

Preface

This article provides a practical guide to integrating Zeek with GrayLog for real-time network traffic monitoring and log visualization. It begins by introducing Zeek as a powerful, flexible network security monitor capable of deep protocol analysis and high-performance traffic inspection. The guide walks through deploying Zeek on CentOS 7 using RPM packages, configuring the NIC in promiscuous mode, and enabling JSON log output. It then details how to use graylog-sidecar and Filebeat to forward Zeek logs to GrayLog, where logs are parsed and visualized through dashboards. Key steps include setting up traffic mirroring, editing Zeek config files, and configuring GrayLog inputs and extractors. The article concludes with tips for extending functionality, such as integrating with the ThreatBook API for threat intelligence. Overall, it demonstrates a complete workflow for building a Zeek+GrayLog network monitoring solution.

1. Zeek

Zeek Network Security Monitor: A powerful framework for network traffic analysis and security monitoring, Zeek network monitoring offers deep insights into network behavior, enabling effective threat detection and incident response.

Zeek+GrayLog

  • 1. In-Depth Analysis: Zeek comes with analyzers for many protocols, enabling high-level semantic analysis at the network application layer.
  • 2. Highly Adaptable and Flexible: Zeek’s domain-specific scripting language allows for site-specific monitoring policies, meaning it’s not limited to any particular detection method.
  • 3. Efficiency: Zeek is designed for high-performance networks and is deployed and running on many large-scale sites.
  • 4. Advanced Statefulness: Zeek maintains extensible state information about the network application layer it monitors and provides advanced archiving of network activity.

Official Documentation

Copy

Reference Links

Copy

After reading the article https://linux.cn/article-14770-1.html titled “Integrating Zeek with the ELK Stack”

Zeek network monitoring

I decided to explore whether Zeek’s network traffic monitoring logs could be sent to GrayLog and visualized there.

Summary of the implementation approach and issues to be addressed:

  • 1. Zeek deployment (whether it can be deployed via RPM packages, as compiling is too time-consuming)
  • 2. Traffic mirroring: how to configure the Zeek server’s NIC in promiscuous mode and how to configure switch traffic mirroring
  • 3. Zeek traffic analysis log reading: convert Zeek logs to JSON format, use graylog-sidecar + filebeat to read them, and extract fields using a JSON extractor
  • 4. Querying and configuring dashboards in GrayLog

The detailed implementation process is as follows:

2. Download and Deploy Zeek Using CentOS7 RPM Packages

Copy

Due to network speed issues, I manually downloaded the necessary Zeek RPM dependency packages in advance.

1. Install Zeek for Zeek network monitoring

Copy

2: Add /opt/zeek/bin to the PATH environment variable for Zeek network monitoring

Copy

3. Enable promiscuous mode on the NIC for Zeek network monitoring

Copy

Switch traffic mirroring configuration is not demonstrated here. Please refer to the article in the following link and configure it based on your actual network environment:

Copy

4. Edit the ‘node.cfg’ file for Zeek network monitoring

Copy

5. Edit the ‘local.zeek’ file for Zeek network monitoring

Copy

6. Start Zeek

Copy

7. View Zeek network monitoring traffic analysis logs

Copy

Currently, all logs are in JSON format.

3. Deploy graylog-sidecar + filebeat to Read Zeek Logs

1. Download and install the RPM packages for graylog-sidecar and filebeat for Zeek network monitoring

Copy

2. Generate a token for the sidecar and update its configuration for Zeek network monitoring

Copy

3. Start graylog-sidecar and apply the configuration

Copy

4. Configure a Beat-type Input in Graylog

Open port 5044 in the firewall

Copy

5. Confirm log reception

4. Configure JSON Field Extraction and Dashboard in Graylog

5. Summary

1. All RPM installation packages used in this article have been bundled. Download link:

Copy

2. Extension

If possible, Zeek traffic logs can be integrated with the ThreatBook API for correlation queries, enabling detection and alerting of abnormal DNS and other traffic.

Refer to the previous article:

Using HTTP JSONPath in GrayLog to Call ThreatBook Online Cloud API for Threat IP Identification