diff -uNr a/logotron/MANIFEST.TXT b/logotron/MANIFEST.TXT --- a/logotron/MANIFEST.TXT b22dbb3579aab3629907f6ee3690c6efa9fc883f48f95591db1242755c5cbb34a75cced595562444b472b1de5448d9652c9b7335e28ffd2531550a1af670da84 +++ b/logotron/MANIFEST.TXT dbba91f83102533d1e4c0c7efa6c861054c4a9c7ce713f92813916f9a5692592a8d0e2efbb8ebe0d3c87ddd7477581228e59d3a9d52dabfde0a0d18fc13e4bf8 @@ -8,3 +8,4 @@ 590714 znc2tmsr_etc lobbes "Converter of znc logs to the tmsr format used by the logotron. Small fixes to eat_dump.py." 593779 uptimefix_bye_cache lobbes "Fix in bot.py for global time_last_conn. Remove Cache from reader.py. Small README fix re: create database." 594463 raw_line_fix lobbes "Fix to raw line export in reader.py to remove semi-colon from right side of nick on action lines" +595435 irssi_format diana_coman "Updates the irssi2tmsr converter to work on out-of-the-box irssi format. Updated README file too with example of format." diff -uNr a/logotron/logconverters/irssi2tmsr/README.TXT b/logotron/logconverters/irssi2tmsr/README.TXT --- a/logotron/logconverters/irssi2tmsr/README.TXT d6c6fb0c6c00f85a0665614bffa30cd804bcf49e55ce78d58f8c744b7cbac8657fccad1d6ed5a47a85ba11e71f2e583775d7e4fc36980b5af8f7958c28802cc7 +++ b/logotron/logconverters/irssi2tmsr/README.TXT 9311bb85e6d71e467394a0ed7231617286ad1e560c10e9bf5b3de302751e69888d1a61ea239cd98d435170f7ca8806123356c65f0c3074dc501a7cb40f53d1b2 @@ -9,5 +9,20 @@ sh convert.sh 10001 < inputfile > outputfile 3. Caveats: - - the converter expects months to be recorded numerically in the input file (e.g. 8, 9 instead of Aug, Sep); if your irssi log uses names for months then you'll need to either update the converter or convert month names to numbers separately, as a pre-converter step. - based on the previous raw awk version published at http://logs.nosuchlabs.com/log/trilema/2019-08-11#1927486 and tested *only* on one irssi log of #ossasepia (result can be seen at: deedbot.org/deed-589684-1.txt ) + - the converter works on the "out-of-the-box" irssi log format, as currently seen, for instance: + +--- Day changed Mon Jul 15 2019 +16:46 --> moopet [~moopet@unaffiliated/moopet] has joined #ossasepia +16:46 moopet: Aloha +16:46 diana_coman: hello moopet +16:46 diana_coman: what brings you here? +16:47 * moopet read a comment on dev.to about TMSR and V and hasn't a clue what they are + +will produce (./convert.sh 2 < in.log > out.log) as output: + +2;1563205560;moopet;Aloha +3;1563205560;diana_coman;hello moopet +4;1563205560;diana_coman;what brings you here? +5;1563205620;*;moopet read a comment on dev.to about TMSR and V and hasn't a clue what they are + diff -uNr a/logotron/logconverters/irssi2tmsr/convert.sh b/logotron/logconverters/irssi2tmsr/convert.sh --- a/logotron/logconverters/irssi2tmsr/convert.sh b8ce803dc74070a6ba41b992e99050526777d4e12076268eee0d47a4051ba343bd3d16e9695438f7e9ab5343dfe6c17773ce018be63912978e4ad58bb8409297 +++ b/logotron/logconverters/irssi2tmsr/convert.sh 4bea5bd0e9d8015edd85ba003f76fd2ac0d42611aa03bbf8232e1681d8f1bda22d6cc3eb707eaf54e604cc690a14bfba85a487f45cb98490530f6a2b449d014d @@ -5,14 +5,17 @@ exit 1 fi -awk -v mindex=$1 '/Day changed/ {Month=$5; Day=$6; Year=$7;} - /Log opened/ {Month=$5; Day=$6; Year=$10;} - ! /-|<--|>/ {count++; sep=";"; - w= Year " " Month " " Day " " $1 " " $2 " 00"; - if ($3 == "*") { - pp=$3 sep $4 " "; $4=""; n=5; +awk -v mindex=$1 'BEGIN{months="JanFebMarAprMayJunJulAugSepOctNovDec"} + /Day changed/ {Month=int((index(months,$5)+2)/3); Day=$6; Year=$7;} + + /Log opened/ {Month=int((index(months,$5)+2)/3); Day=$6; Year=$8;} + ! /(-->)|(<--)|(---)/ {count++; sep=";"; + w= Year " " Month " " Day " " substr($1, 1, 2) " " substr($1, 4, 5) " 00"; + if ($2 == "*") { + pp= $2 sep $3 " "; $3=""; n=4; } else { - pp=$3 sep; n=4;}; - $1=""; $2=""; $3=""; + pp=substr($2, 1, length($2)-1) sep; n=3;}; + $1=""; $2=""; print count+mindex-1 sep mktime(w) sep pp substr($0,n); }' +