Time format in access.log of squid

Hi,
if somebody could implement the following line to the squid.conf the date in access.log is more readable.

logformat readable %{%d.%m.%y %H:%M:%S}tl %>a %Ss %ru

2 Likes

I have tested this, but I think it may break all log file analysis tools (lightsquid comes to mind).
I use this command to read logs:
awk '{print strftime("%c", $1), $0}' /var/log/squid/access.log

If you could confirm that external tools like lightsquid do not break with the new log format, I’ll sponsor your request.

I can’t test it, because if I want to open Lightsquid from Server-Manager / Applications I only get an errorpage:

Nethgui:

404 - Language not found

1377519247

I didn’t do any changes at squid.conf till now.
It dosn’t make any difference if I test it with english or german language.

Can somebody help me with this problem?

It works for me after reboot NS.

Also after I have installed Shared folders + samba audit, when I wanted to access Samba audit I had the same “error”. After reboot NS, everything worked fine.

1 Like

Thanks for your answer, I’ll try it later because I can’t rebbot at this time.
I’ll be back if I’ve tested it.

Ok thanks, it works well now. I’ll test to change the config now.

1 Like

Can somebody help me? I’ve copied the /etc/e-smith/templates/etc/squid.conf/90options to
/etc/e-smith/templates-custom/etc/squid.conf/90options and modified it with the line in my first post. After that I restart the squid-service but nothing happened to my access.log.
In a “self-build” squid without nethserver this line in the squid.conf is the road to success.

The correct path name is /etc/squid/squid.conf.
I think you’re missing a step before restart:
expand-template /etc/squid/squid.conf

1 Like

You’re right I’ve forgotton the expand-template command.
But now I have the next problem:

expand-template /etc/squid/squid.conf
WARNING in /etc/e-smith/templates-custom//etc/squid/squid.conf/90options: Operator or semicolon missing before %H at /etc/e-smith/templates-custom//etc/squid/squid.conf/90options line 4.
WARNING in /etc/e-smith/templates-custom//etc/squid/squid.conf/90options: Ambiguous use of % resolved as operator % at /etc/e-smith/templates-custom//etc/squid/squid.conf/90options line 4.
ERROR in /etc/e-smith/templates-custom//etc/squid/squid.conf/90options: Program fragment delivered error <<syntax error at /etc/e-smith/templates-custom//etc/squid/squid.conf/90options line 4, near “H:”>> at template line 4
ERROR: Template processing failed for //etc/squid/squid.conf: 2 fragments generated warnings, 1 fragment generated errors
at /sbin/e-smith/expand-template line 45.

In configfile it is correct without an operator. I tried it with a semicolon in the template, than I only get this error:

expand-template /etc/squid/squid.conf ERROR in /etc/e-smith/templates-custom//etc/squid/squid.conf/90options: Program fragment delivered error <<syntax error at /etc/e-smith/templates-custom//etc/squid/squid.conf/90options line 4, near “%H:”>> at template line 4
ERROR: Template processing failed for //etc/squid/squid.conf: 1 fragment generated errors
at /sbin/e-smith/expand-template line 45.

Curly brackets need to be protected in templates.
Substitute all { and } with \{ and \}.

Hi filippo,
can you explain it to me with an example?
I don’t know how to protect the curly brackets.
You wrote I’ve to change { and ] to { and }, but I only used { and }

Discourse need brackets protection too. :slight_smile:

Substitute all { and } with \{ and \}.

1 Like

Thanks, the expand-template command works without any errors now, but the access.log didn’t change the format. I’ ve set my entry to the end of 90options, is it a problem?

I’ve forgotton one line in my template, now it is working and I will test it.
This is my template 90options at this time:

#
# 90options
#
# logformat (name) (format specification)
logformat readable %{%d.%m.%y %H:%M:%S}tl %>a %Ss %ru
#access_log /var/log/squid/access.log squid
access_log /var/log/squid/access.log readable

forward_max_tries 25
shutdown_lifetime 1 seconds
buffered_logs on
max_filedesc 16384
logfile_rotate 0

1 Like

I think you are right, lightsquid dosn’t work anymore. It dosn’t show anything since the point I’ve changed the config.
I don’t need lightsquid, so for me it’s a solution, but not for everyone.

What’s about the idea to change the request of the logfile in the gui logviewer in the way Filippo wrote.