aboutsummaryrefslogtreecommitdiffstats
path: root/config/squid3
diff options
context:
space:
mode:
Diffstat (limited to 'config/squid3')
-rwxr-xr-xconfig/squid3/34/squid_log_parser.php44
1 files changed, 20 insertions, 24 deletions
diff --git a/config/squid3/34/squid_log_parser.php b/config/squid3/34/squid_log_parser.php
index 8d0cbc20..c55db021 100755
--- a/config/squid3/34/squid_log_parser.php
+++ b/config/squid3/34/squid_log_parser.php
@@ -1,24 +1,22 @@
#!/usr/local/bin/php -q
<?php
-/* ========================================================================== */
/*
squid_log_parser.php
- part of pfSense (http://www.pfSense.com)
+ part of pfSense (https://www.pfSense.org/)
Copyright (C) 2012-2014 Marcello Coutinho
- Copyright (C) 2012-2014 Carlos Cesario - carloscesario@gmail.com
+ Copyright (C) 2012-2014 Carlos Cesario <carloscesario@gmail.com>
+ Copyright (C) 2015 ESF, LLC
All rights reserved.
- */
-/* ========================================================================== */
-/*
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -30,28 +28,26 @@
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
- */
-/* ========================================================================== */
-
-# ------------------------------------------------------------------------------
-# Simple Squid Log parser to rewrite line with date/time human readable
-# Usage: cat /var/squid/log/access.log | parser_squid_log.php
-# ------------------------------------------------------------------------------
+*/
+/*
+* Simple Squid Log parser to rewrite line with date/time human readable
+* Usage: cat /var/squid/log/access.log | parser_squid_log.php
+*/
$logline = fopen("php://stdin", "r");
-while(!feof($logline)) {
+while (!feof($logline)) {
$line = fgets($logline);
$line = rtrim($line);
if ($line != "") {
$fields = explode(' ', $line);
// Apply date format
- $fields[0] = date("d.m.Y H:i:s",$fields[0]);
- foreach($fields as $field) {
- // Write the Squid log line with date/time human readable
- echo "{$field} ";
+ $fields[0] = date("d.m.Y H:i:s", $fields[0]);
+ foreach ($fields as $field) {
+ // Write the Squid log line with human readable date/time
+ echo "{$field} ";
}
echo "\n";
}
}
fclose($logline);
-?> \ No newline at end of file
+?>