Frederic Marchal [Fri, 12 Dec 2014 16:23:45 +0000 (17:23 +0100)]
Improve the message helping the user to set the translation up
It isn't easy to figure out where sarg searches for sarg.mo. Running sarg
like sarg -x -v display the usual version number and a message giving
enough information to know where to put the message file.
Frederic Marchal [Thu, 11 Dec 2014 14:01:23 +0000 (15:01 +0100)]
Display locale information for debugging purpose
Running sarg -x -v display the version number but also the directory where
the message file is looked for, the package name and the currently
selected locale.
Frederic Marchal [Wed, 10 Dec 2014 20:28:17 +0000 (21:28 +0100)]
Display a column with the user's IP address in the top user report
In sarg.conf, topuser_fields accept the new USERIP parameter to display
a new column with the user's IP address. It is only useful if the IP
address is replaced by a name or resolved to a host name.
Log file names are stored in a tree to save space. They have to be merged
back when the full file name is required. But an error prevented the file
name from being reconstructed if two files were stored in different
directories and one node of the tree has a lower depth than the next
one.
When index_tree is set to "date", the reports are stored in a tree based
on their content's date. The existing code was somewhat broken.
In addition, the directory size used to be computed and displayed in the
years index file. It is now computed and displayed in the months and days
indexes.
Delete old reports when index_tree is set to "date"
Sarg goes to great length to make sure no unrelated directories are
deleted.
A list of every report directory is build. It is sorted in ascending order
on the last modification time. If too many directories are present, the
oldest ones are deleted including the possibly remaining empty parent
directory.
The index.html file is not rebuild to account for the deleted reports yet.
Use a global constant instead of the "index.html" file name in the code
The name of the html index file is defined once in the source code as a
global constant instead of littering the source code with a hard coded
litteral string.
Verbose output with correct period covered by the logs
Previous versions reported the period covered by the log but it was, in
fact, the period extracted from the log limited to the requested range.
Now, two distinct messages are displayed in verbose mode. The first is the
period really covered by the log files. The second is the range taken into
account to produce the report.
Use the last modification time to sort the old reports directories. The
previously used ctime is not the creation time but the time at which the
directory meta data was last modified.
Creating the old report list don't use temporary files nor the external
sort command. Everything is kept and sorted in memory.
The code make sure the report directory looks like one of our report
directory. This is a safety to avoid deleting an unrelated directory.
Currently this safety mechanism only detects directories created with in
index_tree set to "file".
I used to always forget to update the ChangeLog before releasing sarg. It
won't happen if the archive script check that the ChangeLog contains an
entry for the current version and release date.
This patch was suggested by Diego Elio Pettenò on May 25, 2011 and
implemented in commit b966a3a224de2a6ea591458bec47c1bb4e9b3745 but the
patch had not been applied to the CMake build file.
Some systems define _FORTIFY_SOURCE by default. It conflicts with our use
of that macro when --enable-extraprotection is passed to the configuration
script.
The solution is to undefine it before redefining it with value 2.
If a higher _FORTIFY_LEVEL level ever appears, it will have to be used in
this program to benefit from the highest protection possible.
Frederic Marchal [Sun, 15 Jun 2014 14:44:56 +0000 (16:44 +0200)]
Help in diagnosing the number of old reports to keep
The lastlog and lastlog1 files are stored in the temporary directory
instead of the output directory and they are not deleted when sarg exits
if the user asked not to delete temporary files.
Some debug messages give indication about what is happening with respect
to the old reports deletion.
If sarg is ran with option -l combined with any other option such as -xl,
then the -l option is mistaken as --lastlog and does not produce the
expected result (which is to use the access.log file passed as argument).
It has been fixed by requiring that any long option is préfixed with a
double dash.
It breaks the compatibility with old versions but nobody should notice.
Thanks to Leonardo Rodrigues for reporting this bug.
Use a string to decide the content of the per_user_limit file
Instead of a numerical value 0/1, the strings "ip" or "id" are used in the
per_user_limit option to decide if the file contains the IP address or the
user's ID.
Frederic Marchal [Thu, 30 May 2013 08:41:01 +0000 (10:41 +0200)]
Avoid rereading the user_limit file each time a user is added
Each time a user reach the download limit, he/she is added to the
user_limit file only once. Instead of rereading the whole file to see if
the user is already there, a flag is kept in memory to track already
limited users.
Frederic Marchal [Fri, 25 Jan 2013 20:58:31 +0000 (21:58 +0100)]
Ugly patch to link on Windows
Library ws2_32 is required when compiling on Windows but the autoconf macro
to test for a library doesn't work due to the special declaration of the
functions in that library.
Frederic Marchal [Thu, 24 Jan 2013 21:17:23 +0000 (22:17 +0100)]
Write the access times in one html page
Web sites access times were written in a file named after the user's name
and the visited site URL. There were one file per site, they were small and
numerous. In fact, they could be so numerous that they could fill the disk
inode table.
Moreover, with a file name made of the user's name and the visited site
URL, the manufactured file name could be more than 256 characters resulting
in an OS error on Windows and Linux.
To fix these two problems, the access times are all grouped inside one web
page with anchors to directly scroll to the relevant site. The html file
name is fixed (tt.html) and doesn't depend on the user's name or web
site URL.
Frederic Marchal [Sat, 12 Jan 2013 09:20:46 +0000 (10:20 +0100)]
Packaging script accepts a tag with a translation suffix
When a translation is submitted after the version has been tagged, a new
tag is added with the language as a suffix. It must be accepted by the
packaging script.
Due to an error, the file name created by mangling the user ID was not
using the suffix that was supposed to make it unique. Therefore, user's
names made of several consecutive non alphanumeric characters were not
unique.
The error manifested itself as an error message saying that the
_.user_unsort file could not be sorted. It occurred after the first
user assigned to the _ file name had been sorted and its file deleted.
Therefore any subsequent user sharing the _ file name would fail.
This patch also makes sure no original user name might possibly ends up
being the same as a mangled name.
Use the string buffer object to store the strings corresponding to the
users. It takes much less memory as the strings only take the exact amount
of memory instead of allocating a fixed size buffer as big as the biggest
expected string.
Frederic Marchal [Wed, 26 Dec 2012 16:23:54 +0000 (17:23 +0100)]
Explain why some input log lines are ignored
When verbose mode is enabled, a listing explaining how many lines have
been excluded is displayed. Every reason to ignore a line is listed. It
should make it easier to figure out why the report is not generated.
Frédéric Marchal [Sun, 16 Dec 2012 17:03:51 +0000 (18:03 +0100)]
Make a translator friendly message out of pieced together words
The "generated by" message written at the page bottom was made out of
words assembled together during the page generation. It was not possible
to translate that message.