I'm doing the next statement on my ubuntu:
split --number=l/5 /pathToSource.csv /pathToOutputDirectory
If i do a "ls"
myUser#serverNAme:/pathToOutputDirectory> ls -la
total 21467452
drwxr-xr-x 2 myUser group 4096 Jun 23 08:51 .
drwxrwxrwx 4 myUser group 4096 Jun 23 08:44 ..
-rw-r--r-- 1 myUser group 10353843231 Jun 23 08:48 aa
-rw-r--r-- 1 myUser group 0 Jun 23 08:48 ab
-rw-r--r-- 1 myUser group 11376663825 Jun 23 08:51 ac
-rw-r--r-- 1 myUser group 0 Jun 23 08:51 ad
-rw-r--r-- 1 myUser group 252141913 Jun 23 08:51 ae
If i do a "du" over ab and ad files.
$du -h ab ad
0 ab
0 ad
As you can see, split divided the file in a non-homogeneous form.
Anyone know what's going on?
Some unprintable character can hang the split?
Thank you.
Best Regards!
Francisco.
While this is unusual data with an average line length of 114137, I'm not sure that fully describes the issue. Hmm you've 21982648969 of data => each bucket that split is trying to fill is 4396529793. That's larger than 2^32. I wonder do we have a 32 bit overflow. Are you on a 32 bit or 64 bit platform? Looking at the code I don't see an overflow issue TBH. Note you could anonymize and compress the data providing the following file for download somewhere:
tr -c '\n' . < /pathToSource.csv | xz > /pathToSource.csv.xz
It's also worth specifying the version since implementation changed a bit between v8.8 and v8.13
A workarround in groovy:
class Sanitizer {
public static void main(String[] args) {
def textOnly = new File('/path/NoDanger.txt')
def data = new File('/path/danger.txt')
String line = null
data.withReader { reader ->
while ( ( line = reader.readLine() ) != null ){
/*char[] stringToCharArray = line.toCharArray();
for(int i = 0; i < 5; i++ ){
char a = stringToCharArray[i]
int b = Character.getNumericValue(a);
println Integer.toHexString(b)
if (!(b =~ /\w/)) {
println "inside"
} else println "outside"
}*/
String newString = line.replaceAll("[^\\p{Print}]", "");
textOnly << newString+"\n"
}
} //reader
}
}
Related
I am trying to use awk command to perform multiple search to fetch records from a log file WHERE it matches following 2 conditions :
pattern - EXEC_TIME
last column i.e. having EXEC_TIME > 5000 ms.
I tried and used below command but its not giving me correct output, not sure if can be use same way!
I am just learning awk so any help will be appreciated.
awk -F ':' '/EXEC_TIME/&&$15>="5000"{print $2,$15}' TransactionInfoLogs.log
MP170420.0548.T00003[SERV] 9065 ms
OC170420.0655.T00001[SERV] 708 ms
Below is sample log file:
[TXN_ID]:MP170420.0548.T00003[SERV][SERV]:BLKSRVREQ[MSISDN]:8028359017[SV_CHRG_ID]:37152[RESP_CODE]:200[START]:Thu Apr 20 12:44:23 WAT 2017 [END]:Thu Apr 20 12:44:23 WAT 2017[EXEC_TIME]:9065 ms
[TXNID]:XX170420.1244.C01465[TYPE]:SERVICE_CHARGE_PAYER_PAYEE[AMT]:0[PR_MSISDN]:8028359017[PR_MFS]:101[PR_W_TYPE]:12[PR_PREBAL]:0[PR_BAL]:0[PY_MSISDN]:IND03[PY_MFS]:101[PY_W_TYPE]:null[PY_PRE
BAL]:2782239[PY_BAL]:2782239
[2017-04-20 12:44:29,552][http-bio-172.24.87.5-7890-exec-7365]-
[TXN_ID]:XX170420.1244.C01467[SERV]:null[MSISDN]:8080967233[RESP_CODE]:00066[START]:Thu Apr 20 12:44:29 WAT 2017 [END]:Thu Apr 20 12:44:29 WAT 2017[EXEC_TIME]:9 ms
[2017-04-20 12:44:36,634][http-bio-172.24.87.5-7890-exec-7364]-
[TXN_ID]:OC170420.0655.T00001[SERV]:null[MSISDN]:7016532415[RESP_CODE]:00066[START]:Thu Apr 20 12:44:36 WAT 2017 [END]:Thu Apr 20 12:44:36 WAT 2017[EXEC_TIME]:708 ms
[2017-04-20 12:44:45,820][http-bio-172.24.87.5-7890-exec-7359]-
[TXN_ID]:XX170420.1244.C01471[SERV]:null[MSISDN]:8026136275[RESP_CODE]:00066[START]:Thu Apr 20 12:44:45 WAT 2017 [END]:Thu Apr 20 12:44:45 WAT 2017[EXEC_TIME]:39 ms
[2017-04-20 12:44:46,010][http-bio-172.24.87.5-7890-exec-7366]-
[TXN_ID]:XX170420.1244.C01473[SERV]:BLKSRVREQ[MSISDN]:8127459541[SV_CHRG_ID]:37152[RESP_CODE]:200[START]:Thu Apr 20 12:44:45 WAT 2017 [END]:Thu Apr 20 12:44:46 WAT 2017[EXEC_TIME]:221 ms
[TXNID]:XX170420.1244.C01473[TYPE]:SERVICE_CHARGE_PAYER_PAYEE[AMT]:0[PR_MSISDN]:8127459541[PR_MFS]:101[PR_W_TYPE]:12[PR_PREBAL]:0[PR_BAL]:0[PY_MSISDN]:IND03[PY_MFS]:101[PY_W_TYPE]:null[PY_PRE
BAL]:2853870[PY_BAL]:2853870
[2017-04-20 12:44:49,989][http-bio-172.24.87.5-7890-exec-7371]-
[TXN_ID]:XX170420.1244.C01475[SERV]:BLKSRVREQ[MSISDN]:8089138902[SV_CHRG_ID]:37152[RESP_CODE]:200[START]:Thu Apr 20 12:44:49 WAT 2017 [END]:Thu Apr 20 12:44:49 WAT 2017[EXEC_TIME]:57 ms
[TXNID]:XX170420.1244.C01475[TYPE]:SERVICE_CHARGE_PAYER_PAYEE[AMT]:0[PR_MSISDN]:8089138902[PR_MFS]:101[PR_W_TYPE]:12[PR_PREBAL]:0[PR_BAL]:0[PY_MSISDN]:IND03[PY_MFS]:101[PY_W_TYPE]:null[PY_PRE
BAL]:3071459[PY_BAL]:3071459
Whenever you have name->value mappings in an input file it's a good idea to first create an array of that mapping (n2v[] below) and then you can just reference each field by it's name rather than it's position, e.g.:
$ cat tst.awk
{
delete n2v
while ( match($0,/\[[^]]+]:/) ) {
if ( name != "" ) {
value = substr($0,1,RSTART-1)
sub(/\[.*/,"",value)
n2v[name] = value
}
name = substr($0,RSTART+1,RLENGTH-3)
$0 = substr($0,RSTART+RLENGTH)
}
value = $0
n2v[name] = value
for (name in n2v) {
value = n2v[name]
print name, "->", value
}
}
$ head -1 file | awk -f tst.awk
EXEC_TIME -> 9065 ms
START -> Thu Apr 20 12:44:23 WAT 2017
RESP_CODE -> 200
SV_CHRG_ID -> 37152
TXN_ID -> MP170420.0548.T00003
END -> Thu Apr 20 12:44:23 WAT 2017
MSISDN -> 8028359017
SERV -> BLKSRVREQ
You can then tweak the above to do whatever you want:
$ cat tst.awk
{
delete n2v
while ( match($0,/\[[^]]+]:/) ) {
if ( name != "" ) {
value = substr($0,1,RSTART-1)
sub(/\[.*/,"",value)
n2v[name] = value
}
name = substr($0,RSTART+1,RLENGTH-3)
$0 = substr($0,RSTART+RLENGTH)
}
value = $0
n2v[name] = value
}
n2v["EXEC_TIME"]+0 > 5000 { print n2v["TXN_ID"], n2v["EXEC_TIME"] }
$ awk -f tst.awk file
MP170420.0548.T00003 9065 ms
I'm working with Yocto to create an embedded linux distribution for an ARM device (i.MX 6Quad Processors).
I've configured the list of desired locales with the variable:
IMAGE_LINGUAS = "de-de fr-fr en-gb en-gb.iso-8859-1 en-us en-us.iso-8859-1 zh-cn"
As result I've obtained a file systems that contains the following folders:
root#lam_icu:/usr/lib/locale# cd /usr/share/locale/
root#lam_icu:/usr/share/locale# ls -la
total 0
drwxr-xr-x 6 root root 416 Nov 17 2016 .
drwxr-xr-x 30 root root 2056 Nov 17 2016 ..
drwxr-xr-x 4 root root 296 Nov 17 2016 de
drwxr-xr-x 3 root root 232 Nov 17 2016 en_GB
drwxr-xr-x 4 root root 296 Nov 17 2016 fr
drwxr-xr-x 4 root root 296 Nov 17 2016 zh_CN
and:
root#lam_icu:/usr/share/locale# cd /usr/lib/locale/
root#lam_icu:/usr/lib/locale# ls -la
total 0
drwxr-xr-x 9 root root 640 Mar 13 2017 .
drwxr-xr-x 32 root root 40000 Mar 13 2017 ..
drwxr-xr-x 3 root root 1016 Mar 13 2017 de_DE
drwxr-xr-x 3 root root 1016 Mar 13 2017 en_GB
drwxr-xr-x 3 root root 1016 Mar 13 2017 en_GB.ISO-8859-1
drwxr-xr-x 3 root root 1016 Mar 13 2017 en_US
drwxr-xr-x 3 root root 1016 Mar 13 2017 en_US.ISO-8859-1
drwxr-xr-x 3 root root 1016 Mar 13 2017 fr_FR
drwxr-xr-x 3 root root 1016 Mar 13 2017 zh_CN
Which is the encoding of all non ISO-8859-1 locales? Can I assume that "en_GB" or "en_US" use the UTF-8 encoding?
I've tried to open the "LC_IDENTIFICATION" file, the result is:
Hc�������������cEnglish locale for the USAFree Software
Foundation,
Inc.http://www.gnu.org/software/libc/bug-glibc-locales#gnu.orgEnglishUSA1.02000-06-24en_US:2000en_US:2000en_US:2000en_US:2000en_US:2000en_US:2000en_US:2000en_US:2000en_US:2000en_US:2000en_US:2000en_US:2000UTF-8
At the end of the file there is something that recalls "UTF-8". Is this enough to assume that the encoding is UTF-8?
How to check if a locale is UTF-8?
LC_IDENTIFICATION doesn't tell you much:
LC_IDENTIFICATION - this is not a user-visible category, it contains information about the locale itself and is rarely useful for users or developers (but is listed here for completeness sake).
You'd have to look at the complete set of files.
There appears to be no standard command-line utility for doing this, but there is a runtime call (added a little later than the original locale functions). Here is a sample program which illustrates the function nl_langinfo:
#include <stdio.h>
#include <locale.h>
#include <langinfo.h>
int
main(int argc, char **argv)
{
int n;
for (n = 1; n < argc; ++n) {
if (setlocale(LC_ALL, argv[n]) != 0) {
char *code = nl_langinfo(CODESET);
if (code != 0)
printf("%s ->%s\n", argv[n], code);
else
printf("?%s (nl_langinfo)\n", argv[n]);
} else {
printf("? %s (setlocale)\n", argv[n]);
}
}
return 0;
}
and some output, e.g., by foo $(locale -a):
aa_DJ ->ISO-8859-1
aa_DJ.iso88591 ->ISO-8859-1
aa_DJ.utf8 ->UTF-8
aa_ER ->UTF-8
aa_ER#saaho ->UTF-8
aa_ER.utf8 ->UTF-8
aa_ER.utf8#saaho ->UTF-8
aa_ET ->UTF-8
aa_ET.utf8 ->UTF-8
af_ZA ->ISO-8859-1
af_ZA.iso88591 ->ISO-8859-1
af_ZA.utf8 ->UTF-8
am_ET ->UTF-8
am_ET.utf8 ->UTF-8
an_ES ->ISO-8859-15
an_ES.iso885915 ->ISO-8859-15
an_ES.utf8 ->UTF-8
ar_AE ->ISO-8859-6
ar_AE.iso88596 ->ISO-8859-6
ar_AE.utf8 ->UTF-8
ar_BH ->ISO-8859-6
ar_BH.iso88596 ->ISO-8859-6
The directory names you're referring to are often (but not required) to be the same as encoding names. That is the assumption made in the example program. There was a related question in How to get terminal's Character Encoding, but it has no useful answers. One is interesting though, since it asserts that
locale charmap
will give the locale encoding. According to the standard, that's not necessarily so:
The command locale charmap gives the name used in localedef -f
However, localedef attaches no special meaning to the name given in the -f option.
localedef has a different option -u which identifies the codeset, but locale (in the standard) mentions no method for displaying this information.
As usual, implementations may (or may not) treat unspecified features in different ways. The GNU C library's documentation differs in some respects from the standard (see locale and localedef), but offers no explicit options for showing the codeset name.
I try to build a short ocaml event example. But when I compile, the error in the title appears.
The question of: unbound module Event error when compiling Ocaml game was not helpful for me.
The system is Kubuntu 14.04 and I installed ocaml over aptitude, so installed packages are:
camlp4, ledit, libfindlib-ocaml, libfindlib-ocaml-dev, liboasis-ocaml, liboasis-ocaml-dev, libodn-ocaml, libodn-ocaml-dev, libtype-conv-camlp4-dev, oasis, ocaml, ocaml-base, ocaml-base-nox, ocaml-compiler-libs, ocaml-doc, ocaml-findlib, ocaml-interp, ocaml-native-compilers, ocaml-nox
The OCaml compiler is version 4.01.0
Here is my short test program.
open Thread;;
open Event;;
let chan = Event.new_channel();;
let a () =
Printf.printf "A waiting...\n";;
let sigRX = Event.receive chan in
Printf.printf "A received over channel\n";
let v = Event.sync sigRx in
Printf.printf "A running\n";
Printf.printf "A done!\n";;
let b () =
Thread.delay 0.8
Printf.printf "B sending...\n";;
let sigTX = Event.send "wake up" in
Event.sync sigTX;
Printf.printf "B done!\n";;
let t_a = Thread.create a ();;
let t_b = Thread.create b ();;
I tried to compile this single file (test.ml) with:
ocamlc -thread unix.cma threads.cma test.ml
The response is:
File "test.ml", line 2, characters 0-10:
Error: Unbound module Event
I googled, found some "thread-using-tips" like: http://caml.inria.fr/pub/docs/manual-ocaml/libthreads.html#c%3Athreads
In /usr/lib/ocaml is an threads folder and an thread.mli. Inside the threads folder there are this files:
-rw-r--r-- 1 root root 487 Jan 2 2014 condition.cmi
-rw-r--r-- 1 root root 487 Jan 2 2014 condition.cmx
-rw-r--r-- 1 root root 1203 Jan 2 2014 event.cmi
-rw-r--r-- 1 root root 1867 Jan 2 2014 event.cmx
-rw-r--r-- 1 root root 421 Jan 2 2014 mutex.cmi
-rw-r--r-- 1 root root 407 Jan 2 2014 mutex.cmx
-rw-r--r-- 1 root root 1859 Jan 2 2014 thread.cmi
-rw-r--r-- 1 root root 1308 Jan 2 2014 thread.cmx
-rw-r--r-- 1 root root 62778 Jan 2 2014 threads.a
-rw-r--r-- 1 root root 47047 Jan 2 2014 threads.cma
-rw-r--r-- 1 root root 1258 Jan 2 2014 threads.cmxa
-rw-r--r-- 1 root root 4145 Jan 2 2014 threadUnix.cmi
-rw-r--r-- 1 root root 1515 Jan 2 2014 threadUnix.cmx
What am I missing? I assume, that the Event is packed in Thread Module?
This command line works for me to get past the unbound module problem.
$ ocamlc -I +threads -c test.ml
There are errors in your code, but I imagine you'll know how to fix them.
This full command line will probably work, but I can't be sure because of the errors:
$ ocamlc -thread -I +threads unix.cma threads.cma test.ml
(There are some higher-level tools for building OCaml programs that you might want to learn about at some point.)
I am running a cron-ed bash script to extract cache hits and bytes served per IP address. The script (ProxyUsage.bash) has two parts:
(uniqueIP.awk) find unique IPs and create a bash script do add up the hits and bytes
run the hits and bytes per IP
ProxyUsage.bash
#!/usr/bin/env bash
sudo gawk -f /home/maxg/scripts/uniqueIP.awk /var/log/squid3/access.log.1 > /home/maxg/scripts/pxyUsage.bash
source /home/maxg/scripts/pxyUsage.bash
uniqueIP.awk
{
arrIPs[$3]++;
}
END {
for (n in arrIPs) {
m++; # count arrIPs elements
#print "Array elements: " m;
arrAddr[i++] = n; # fill arrAddr with IPs
#print i " " n;
}
asort(arrAddr); # sort the array values
for (i = 1; i <= m; i++) { # write one command line per IP address
#printf("#!/usr/bin/env bash\n");
printf("sudo gawk -f /home/maxg/scripts/proxyUsage.awk -v v_Var=%s /var/log/squid3/access.log.1 >> /home/maxg/scripts/pxyUsage.txt\n", arrAddr[i])
}
}
pxyUsage.bash
sudo gawk -f /home/maxg/scripts/proxyUsage.awk -v v_Var=192.168.1.13 /var/log/squid3/access.log.1 >> /home/maxg/scripts/pxyUsage.txt
sudo gawk -f /home/maxg/scripts/proxyUsage.awk -v v_Var=192.168.1.14 /var/log/squid3/access.log.1 >> /home/maxg/scripts/pxyUsage.txt
sudo gawk -f /home/maxg/scripts/proxyUsage.awk -v v_Var=192.168.1.22 /var/log/squid3/access.log.1 >> /home/maxg/scripts/pxyUsage.txt
TheProxyUsage.bash script runs as scheduled and creates the pxyUsage.bash script.
However the pxyUsage.text file is not amended with the latest values when the script runs.
So far I run pxyUsage.bash every day myself, as I cannot figure out, why the result is not written to file.
Both bash scripts are set to execute. Actually the file permissions are below:
-rwxr-xr-x 1 maxg maxg 169 Mar 14 08:40 ProxySummary.bash
-rw-r--r-- 1 maxg maxg 910 Mar 15 17:15 proxyUsage.awk
-rwxrwxrwx 1 maxg maxg 399 Mar 17 06:10 pxyUsage.bash
-rw-rw-rw- 1 maxg maxg 2922 Mar 17 07:32 pxyUsage.txt
-rw-r--r-- 1 maxg maxg 781 Mar 16 07:35 uniqueIP.awk
Any hints appreciated. Thanks.
The sudo(8) command requires a pseudo-tty and you do not have one allocated under cron(8); you do have one allocated when logged in the usual way.
Instead of mucking about with sudo(8), just run the script as the correct user.
If you cannot do that, then in the root crontab, do something like this:
su - username /path/to/mycommand arg1 arg2...
This will work because root can use su(1) without neding a password.
I have Log4perl installed on my Linux machine and have the following /path/to/log4perl.conf:
log4perl.logger.Fizz = INFO, FizzAppender
log4perl.logger.Buzz = INFO, BuzzAppender
log4perl.appender.FizzAppender = Log::Dispatch::FileRotate
log4perl.appender.FizzAppender.filename = /my/logs/fizz-log.txt
log4perl.appender.FizzAppender.max = 1
log4perl.appender.FizzAppender.DatePattern = yyyy-MM-dd
log4perl.appender.FizzAppender.TZ = EST
log4perl.appender.FizzAppender.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.FizzAppender.layout.ConversionPattern = %d %m %n
log4perl.appender.BuzzAppender = Log::Dispatch::FileRotate
log4perl.appender.BuzzAppender.filename = /my/logs/buzz-log.txt
log4perl.appender.BuzzAppender.max = 1
log4perl.appender.BuzzAppender.DatePattern = yyyy-MM-dd
log4perl.appender.BuzzAppender.TZ = EST
log4perl.appender.BuzzAppender.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.BuzzAppender.layout.ConversionPattern = %d %m %n
Inside each of my perl scripts (each script uses a different appender and a logs to a different log file):
use Log::Log4perl;
my $log_conf = "/path/to/log4perl.conf";
Log::Log4perl::init($log_conf);
# In one script the logger is a "Fizz" logger (like below), and in the other
# script the logger is a "Buzz" logger.
my $logger = Log::Log4perl->get_logger("Fizz");
$logger->info("This should work.");
Even though each script uses a different appender and logs to a different file, they should all have the same behavior:
Each log gets rotated once a day, and old (rotated) logs gets deleted
I've had this script running for more than 24 hours now, and I don't see any logs being generated under /my/logs/.
So I ask: is my log4perl.conf incorrect? If not, what can I do to diagnose the issue? Am I initializing the library incorrectly in the perl scripts? Thanks in advance.
I think you need to add the parameter mode to your log4perl.conf file:
log4perl.appender.FizzAppender.mode = truncate
log4perl.appender.BuzzAppender.mode = truncate
To speed things along I've changed your DatePattern to the following:
log4perl.appender.FizzAppender.DatePattern = yyyy-MM-dd-HH-MM
log4perl.appender.BuzzAppender.DatePattern = yyyy-MM-dd-HH-MM
Here's a test using your log4perl.conf file. I've created 2 copies of your Perl script:
log4perl_Buzz.pl
log4perl_Fizz.pl
I've added a loop within the scripts so that every second they log a message to their respective log files:
while (1) {
$logger->info("This should work.");
sleep 1;
}
I run them both at the same time and see the following results using a watch ls -l:
Every 2.0s: ls -l Thu Dec 20 21:16:51 2012
total 12
-rwxrwxr-x 1 saml saml 358 Dec 20 20:15 log4perl_Buzz.pl
-rw-rw-r-- 1 saml saml 978 Dec 20 21:07 log4perl.conf
-rwxrwxr-x 1 saml saml 358 Dec 20 20:15 log4perl_Fizz.pl
After I run the 2 scripts:
Every 2.0s: ls -l Thu Dec 20 21:17:56 2012
total 20
-rw-rw-r-- 1 saml saml 39 Dec 20 21:17 buzz-log.txt
-rw-rw-r-- 1 saml saml 39 Dec 20 21:17 fizz-log.txt
-rwxrwxr-x 1 saml saml 358 Dec 20 20:15 log4perl_Buzz.pl
-rw-rw-r-- 1 saml saml 978 Dec 20 21:07 log4perl.conf
-rwxrwxr-x 1 saml saml 358 Dec 20 20:15 log4perl_Fizz.pl
After ~2 minutes pass:
Every 2.0s: ls -l Thu Dec 20 21:19:05 2012
total 28
-rw-rw-r-- 1 saml saml 195 Dec 20 21:19 buzz-log.txt
-rw-rw-r-- 1 saml saml 2340 Dec 20 21:18 buzz-log.txt.1
-rw-rw-r-- 1 saml saml 234 Dec 20 21:19 fizz-log.txt
-rw-rw-r-- 1 saml saml 2301 Dec 20 21:18 fizz-log.txt.1
-rwxrwxr-x 1 saml saml 358 Dec 20 20:15 log4perl_Buzz.pl
-rw-rw-r-- 1 saml saml 978 Dec 20 21:07 log4perl.conf
-rwxrwxr-x 1 saml saml 358 Dec 20 20:15 log4perl_Fizz.pl
Here's my version of log4perl.conf for those that are playing at home 8-).
log4perl.logger.Fizz = INFO, FizzAppender
log4perl.logger.Buzz = INFO, BuzzAppender
log4perl.appender.FizzAppender = Log::Dispatch::FileRotate
log4perl.appender.FizzAppender.filename = fizz-log.txt
log4perl.appender.FizzAppender.max = 1
log4perl.appender.FizzAppender.DatePattern = yyyy-MM-dd-HH-MM
log4perl.appender.FizzAppender.TZ = EST
log4perl.appender.FizzAppender.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.FizzAppender.layout.ConversionPattern = %d %m %n
log4perl.appender.FizzAppender.mode = truncate
log4perl.appender.BuzzAppender = Log::Dispatch::FileRotate
log4perl.appender.BuzzAppender.filename = buzz-log.txt
log4perl.appender.BuzzAppender.max = 1
log4perl.appender.BuzzAppender.DatePattern = yyyy-MM-dd-HH-MM
log4perl.appender.BuzzAppender.TZ = EST
log4perl.appender.BuzzAppender.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.BuzzAppender.layout.ConversionPattern = %d %m %n
log4perl.appender.BuzzAppender.mode = truncate
These were useful resources in figuring this out:
Log::Dispatch::FileRotate on CPAN
log4perl FAQ
Limiting log size with log4perl - stackoverflow