Monitor Squid Access Logs with Graylog Server

Last Updated:

Welcome to our tutorial on how to monitor squid access logs with Graylog server. Graylog is a leading open-source log management tool that provides real time collection, storage, analysis and enrichment of machine data.

Learn how to install Graylog 3 on CentOS 7 by following the link below.

How to Install Graylog 3.0 Server on CentOS 7

Monitor Squid Access Logs with Graylog server

Well, once you have setup your Graylog server, the next step would to ingest logs from various endpoints for analysis. This guide focuses on monitoring Pfsense squid proxy logs on Graylog. The Pfsense has been configured to forward Squid access logs to a central Rsyslog Server running on Ubuntu 18.04. You can as well forward Squid access logs directly to your Graylog server

You can check our link below on how to configure Rsyslog as a central log server on Ubuntu 18.04.

How to Configure Remote Logging with Rsyslog on Ubuntu 18.04

Create Graylog Squid logs Input

In order to get your data to Graylog server, you need to configure Graylog message inputs to accept the data being sent from various endpoints. In this guide, we are going to configure Graylog to receive Squid data on a Syslog UDP port 5140. Be sure to use ports > 1024 to avoid permission issues with privileged ports (<1024).

Therefore, login to your Graylog server and navigate to System > Inputs. On the Inputs configuration page, select the type of input, in this guide, Syslog UDP and click Launch new input.

monitor squid access logs with Graylog server: Syslog UDP input

Syslog UDP input configuration wizard opens up. Select your Graylog node, Set the name of the input (Title), set the bind address (leave the default and the port to listen on (5140 in this case). Then leave out other settings with defaults.

Graylog Syslog UDP input configuration

Once you are done, click the save button at the bottom of the configuration wizard to save the changes. If all is well, the Syslog UDP input will start to run immediately you save it.

Graylog Syslog UDP input running

Configure Remote Log Forwarding

Since Squid access logs are stored on a central Ubuntu 18.04 log server in this demo, we will go ahead and configure rsyslog to forward logs to Graylog server.

Configure Rsyslog Forwarding

In our central log server, Squid access logs are stored under, /var/log/remotelogs/pfsense/squid/access.logs. Hence, to configure Rsyslog to forward these logs, create a new configuration file as shown below;

vim /etc/rsyslog.d/60-squid.conf
$ModLoad imfile
$InputFileName /var/log/remotelogs/pfsense/squid/access.log
$InputFileTag squid-access
$InputFileStateFile stat-squid-access
$InputFileSeverity info
$InputFileFacility local7
local7.* @;RSYSLOG_SyslogProtocol23Format

Check Rsyslog for any misconfigurations;

rsyslogd -N1

Restart Rsyslog

systemctl restart rsyslog

To verify that the logs are getting to Graylog server, you can use tcpdump command.

tcpdump -i enp0s8 src and "udp port 5140"

View Squid Access Logs on Graylog server

To verify that logs are being received on the defined Graylog input, click show received messaged on your local input.

Graylog syslog udp received messages

When you click on show received messages, you are redirected to Graylog search dashboard where you can view you messages.

monitor squid access logs with Graylog server: Graylog Search dashboard

There you go. You got your Squid access logs on your Graylog server, However, the logs have not been parsed correctly simply because these logs do not conform rules defined in syslog RFCs. Therefore, you need to define Extractors to instruct Graylog nodes on how to extract data from any text in the received Squid log messages.

See our next guide on how to create Graylog squid access logs extractor.

Otherwise, you can try the Content packs from Graylog Marketplace to see if you can get any that works for your Squid logs.

Other related monitoring guides;

Nagios SNMP Monitoring of Linux Hosts on AlienVault USM/OSSIM

Configure Nagios Availability Monitoring on AlienVault USM/OSSIM

Install Elastic Stack 7 on Ubuntu 18.04/Debian 9.8


We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
I am the Co-founder of, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

Leave a Comment