[Dxspider-support] Top users command ?
Dirk Koopman
djk at tobit.co.uk
Sun Mar 26 20:43:39 BST 2023
As the point of this is to find the people that want to spot. So looking
in the log for '^cmd^' or, as in this case more specifically: '|dx|'
I've never got my head around awk, but I do like a one liner:
time grep cmd /spider/local_data/log/2023/*.dat | grep '|dx|' | grep -v
RD1AH |cut -d'|' -f1 | cut -d'^' -f 3 | sort | uniq -c | sort -nr
I have excluded RD1AH from February's totals as, although what he
appeared be spotting might have been legit, repeating himself probably
was rather iffy. I have not taken into account any attempted sniping
(which I suspect this person was doing):
The answer:
709 M6KCI
557 PE2GH
392 G4KQY
218 G4PFZ
197 MI7YDB
194 2E0XBT
181 M0NVK
158 GI4SNA-1
151 PD3RL
122 IW4BLZ
102 G0HOF
75 M7GTP
74 M7JRF
71 FA1KE
70 VA2SS
66 G3YDY
65 2E0IGD
64 G0SDM
49 G4RQI
47 EA5ML
45 HB9ZZ
45 2E0WHQ
40 G3VCN
36 M0UGE
36 F6GCP-9
35 SV3BSF
35 GM4FDM
32 M0YKS
30 MI1M
29 DL6JOE
27 VP8AAE
26 GI4SNA
26 2E1FNP
25 GM0WRR
24 GW4HDF
23 M7GLS-8
23 M0KCV
22 M0BZH
22 DL1GLO
21 M0TPT
21 M0DCX
20 HB9BQP
20 G4EZT
20 DL7JAN-7
20 DF2TDF
18 G5STU
17 MW0LKX
17 M7XTT
17 GM0OQV
16 M7GLS-11
16 G4XNR-14
15 G3NDS
14 WX4CB
14 VK2LQ
14 UR4UY
14 MM0DHQ
14 M7GLS-9
14 HB9DDS
14 G4IZZ
13 GW0GEI
13 G4GIR
13 G0URG
12 G8KPD
12 G1MQQ
11 OK1PI
11 G4DHF
10 M1AOB
10 2E0HEV
9 PY2WLM
9 M1ESA
9 M0XYG
9 GI0UVD
8 VK2EX
8 M7EBZ
8 G4XNR-11
8 EA5NW
7 ZS6AYE
7 R3KIA
7 MI0CBH
7 M7KST
7 M6DAC
7 GM5JET
7 2E0LWI
6 M0NRG-8
6 DK9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1 KF4BZY
1 K7ZV
1 K5YT
1 JE1BMJ
1 JA2CKK
1 IZ4OSH
1 IW7DIE
1 I0KIB
1 HA6NQ
1 GM4YXI
1 GM3WOJ
1 G8SFI
1 G8BCG
1 G6HIE
1 G4XNR-2
1 G4XNR-15
1 G4XNR-1
1 G4UZG
1 G4ODA
1 G1LQT-5
1 G1LQT-4
1 G1LQT-10
1 G1EXK
1 G0KTN
1 G0JOS
1 F6KJU
1 F6KGL
1 F6DJW
1 F5LJA
1 F1GHY-2
1 F1CXX
1 EF2O
1 EA8DKZ
1 EA2AGZ
1 DO2ANW
1 DL2IAN
1 DL1BEC
1 DK3SE
1 DH2YAZ
1 DF2RTA
1 BI4MPA
1 2W1TER
1 2E1HJW
1 2E0YOY
1 2E0RQD-2
1 2E0BGO
real 0m0.168s
user 0m0.089s
sys 0m0.122s
On 26/03/2023 16:05, Boudewijn (Bob) Tenty via Dxspider-support wrote:
> Very handy, thanks Niels.
>
> 73,
>
> Bob/Boudewijn VE3TOK
>
> On 2023-03-26 09:50, Niels PD9Q via Dxspider-support wrote:
>> Hi,
>>
>> Way back I wrote a ugly bash script. On the other hand, it works
>> quite nicely. The output will look something like this.
>>
>> ** Output Generated on 03-26-2023 15:41:23
>> ** Log file : /spider/local_data/log/2023/03.dat
>> ** Files size : 67M
>> ** Lines in the log file : 1184821
>> ** Total of inbound connects : 321
>> ** Total users : 29
>> ** Connected Stations over a month
>> =====================================================================================
>>
>> Wed Mar 1 01:21:31 2023 IW1QLH-34 connected from (removed
>> ip-address)
>> Wed Mar 1 02:22:02 2023 IW1QLH-35 connected from
>> Wed Mar 1 03:22:32 2023 IW1QLH-32 connected from
>> Wed Mar 1 08:24:31 2023 IW1QLH-33 connected from
>> <snip>
>> Mon Mar 13 19:14:55 2023 EC3BH-5 connected from
>> Tue Mar 14 07:52:04 2023 HB9VQQ connected from
>> Sat Mar 18 16:27:45 2023 HB9BB connected from
>> Tue Mar 21 09:59:46 2023 EA3CV-1 connected from
>> Tue Mar 21 18:32:09 2023 EA3CV-22 connected from
>> Sat Mar 25 01:24:47 2023 IZ3WQE connected from
>> =====================================================================================
>>
>> ** End Connected Stations
>>
>> ** Last Connected Stations - Return Connects
>> =====================================================================================
>>
>> Sun Mar 26 04:55:11 2023 YV5GRB connected from (removed
>> ip-address)
>> Sat Mar 25 17:13:39 2023 ON3SCA connected from
>> Sat Mar 25 11:37:45 2023 IW1QLH-35 connected from
>> Fri Mar 24 12:44:59 2023 PA3DRQ connected from
>> <snip>
>> Thu Mar 9 16:31:12 2023 PA5ZL connected from
>> Thu Mar 9 14:04:38 2023 HB9CU connected from
>> Sat Mar 4 00:50:58 2023 PJ7FM connected from
>> Fri Mar 3 06:15:20 2023 HB9BQP connected from
>> Thu Mar 2 12:21:30 2023 PH4E connected from
>> =====================================================================================
>>
>> ** End last Connected Stations
>>
>> Nr Call Times
>> 1 BI4MPH 5
>> 2 EA3CV-1 1
>> 3 EA3CV-22 1
>> 4 EC3BH-1 2
>> 5 EC3BH 4
>> 6 EC3BH-5 1
>> 7 G1DIF 1
>> 8 G7VJA 2
>> 9 HB9BB 7
>> 10 HB9BQP 7
>> 11 HB9BZA 2
>> 12 HB9CU 4
>> 13 HB9VQQ 7
>> 14 IW1QLH-32 32
>> 15 IW1QLH-33 32
>> 16 IW1QLH-34 30
>> 17 IW1QLH-35 27
>> 18 IZ3WQE 1
>> 19 LB4NH 2
>> 20 M0YOL 37
>> 21 ON3SCA 6
>> 22 PA2WCB 62
>> 23 PA3DRQ 8
>> 24 PA5ZL 2
>> 25 PH4E 5
>> 26 PH9M 1
>> 27 PJ7FM 2
>> 28 SN5Y 1
>> 29 YV5GRB 29
>> Script Runtime 327ms
>>
>> Copy and past in a file you like and chmod +x (filename)
>>
>> #!/bin/bash
>> ts=$(date +%s%N)
>> # Path to the log dir
>> path=/spider/local_data/log
>> # Get Month and Year.
>> month=$(date +%m)
>> year=$(date +%Y)
>> # Get the log file.
>> file="$path"/"$year"/"$month".dat
>> if [ -f "$file" ]; then
>> a="$path"/"$year"/"$month".dat
>> else
>> echo "$file does not exist. Error, check the path."
>> fi
>> # Get some info about the log file
>> size=$(du -sh "$path"/"$year"/"$month".dat | awk '{ print $1 }')
>> line=$(wc -l "$a")
>> # Get the connected from.
>> b=$(sed -n '/connected from/p' "$a")
>> # Remove some mess.
>> c=$(echo "$b" | sed -e '/\>^DXProt^\</d' -e 's/\>^DXCommand^\</ /g')
>> # Remove connecteds from localhost (Nobody have to see that i`m
>> connecting 1000 times a day) Remove sk1/sk0.
>> d=$(echo "$c" | sed -e '/127.0.0.1/d' -e '/SK0MMR/d' -e '/SK1MMR/d'
>> -e '/PD9Q/d')
>> # First connect from call... uniq on the second column.
>> e=$(echo "$d" | awk -F '[ .]' '!uniq[$2]++')
>> # Last connect from call sort bottom to top / uniq on the second column.
>> f=$(echo "$d" | sort -t: -k 1nr,1 | awk -F '[ .]' '!uniq[$2]++')
>> # Change the epoch time to reable text (can find any good option in
>> bash so perl it is).
>> g=$(echo "$e" | perl -pe 's/(\d+)/localtime($1)/e')
>> h=$(echo "$f" | perl -pe 's/(\d+)/localtime($1)/e')
>> # Echo to a file, need it to compare.
>> echo "$g" > first
>> echo "$h" > last
>> grep -vxFf first last >last.tmp && mv last.tmp last
>> i=$(cat first)
>> j=$(cat last )
>> # ** Count times connected
>> # Get only the calls
>> m=$(echo "$d" | awk -F' ' '{ print $2}')
>> #
>> count_total=$(echo "$m" | wc -l)
>> # Count the uniq calls, add the times off connection and sort
>> n=$(echo "$m" | awk -- '{for (i = 1; i <= NF; i++) wc[$i] +=1}; END
>> {for (w in wc) print w, wc[w]}' | sort)
>> count_call=$(echo "$n" | wc -l)
>> # Add line number
>> o=$(echo "$n" |awk -v ln=1 '{print ln++ " " $0 }')
>> # Add tab between numbers and words
>> p=$(echo "$o" | awk -v OFS='\t\t' '{ print $1, $2, $3 }')
>>
>> div================================================================
>> div=$div$div
>>
>> width=85
>>
>> printf "\n** Output Generated on %(%m-%d-%Y %H:%M:%S)T\n" $(date +%s)
>> printf "** Log file : "$a"\n"
>> printf "** Files size : "$size"\n"
>> printf "** Lines in the log file : "$line""
>> printf "\n** Total of inbound connects : "$count_total""
>> printf "\n** Total users : "$count_call"\n"
>> printf "** Connected Stations over a month\n"
>> printf "%$width.${width}s\n" "$div"
>> printf "$i\n" | column -t
>> printf "%$width.${width}s\n" "$div"
>> printf "** End Connected Stations\n\n"
>>
>> printf "** Last Connected Stations - Return Connects\n"
>> printf "%$width.${width}s\n" "$div"
>> printf "$j\n" | column -t
>> printf "%$width.${width}s\n" "$div"
>> printf "** End last Connected Stations\n"
>>
>>
>> header="\n%-0s %5s %11s\n"
>> width=38
>> printf "$header" "Nr" "Call" "Times"
>> printf "$p\n" | column -t
>> echo "Script Runtime $((($(date +%s%N) - $ts)/1000000))ms"
>>
>> 73 Niels PD9Q / PI1LAP-1
>>
>> Op 26-3-2023 om 05:32 schreef Tim Tuck via Dxspider-support:
>>> Hi all,
>>>
>>> I want to turn on registration on my node but I'd like to
>>> pre-register my top users in the process to minimise any pain.
>>>
>>> The question then is... who are my top users ?
>>>
>>> I couldn't find a command to show me any form of database of who has
>>> connected to and used my node over the past month other than parsing
>>> the log files for the connected statements.
>>>
>>> So before I go do some scripting around the log files I thought I'd
>>> ask if anyone has done this and can share :)
>>>
>>> Of course I could be missing something obvious so I stand by for a
>>> face palm moment!
>>>
>>> thanks
>>>
>>> Tim
>>>
>>>
>>
>> _______________________________________________
>> Dxspider-support mailing list
>> Dxspider-support at tobit.co.uk
>> https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support
>
More information about the Dxspider-support
mailing list