Home / How do change the location of /var/log/squid/squid.out file?

How do change the location of /var/log/squid/squid.out file?

To change the location of squid.out file, copy /usr/libexec/squid/cache_swap.sh to a new location.

# cp /usr/libexec/squid/cache_swap.sh /usr/libexec/squid/cust_cache_swap.sh

Open with vi and edit the following section in the new file cust_cache_swap.sh.

squid -N -z -F -f $SQUID_CONF >> /new/path/to/squid.out 2>&1

Copy the unit file of squid.service as follows.

# cp /usr/lib/systemd/system/squid.service /etc/systemd/system/

Edit /etc/systemd/system/squid.service.

(before)
ExecStartPre=/usr/libexec/squid/cache_swap.sh

(after)
ExecStartPre=/usr/libexec/squid/cust_cache_swap.sh

Execute the following commands.

# systemctl daemon-reload
# systemctl restart squid

Leave a Reply