analyzing @21 log results

The 21 log command on the 21.co platform is useful as it provides a transaction history–essential both for debugging and for business analysis. Presumably, the latter purpose will recede in importance over time as “API dashboard” features are on 21’s roadmap.  In the meantime, though, 21 log is what we’ve got, and I have to say I find the output a bit cumbersome in its current form.

[21 Activity Log]
2016-10-03 13:55:44 UTC-04:00 : +2750 satoshis to your 21.co balance
Description: You sold 'https://mkt.21.co/pagekicker/nevertrump/buy' to joenye


2016-10-03 13:37:57 UTC-04:00 : -2750 satoshis from your 21.co balance
Description: You bought 'https://mkt.21.co/21dotco/zip_code_data/zipdata/collect?zip_code=94109' from 21dotco


2016-10-03 11:09:55 UTC-04:00 : +3000 satoshis to your 21.co balance
Description: You sold 'http://[fcce:a977:eef0:ac6d:2715:0000:0000:0001]:6002/?uri=qpqpqowowowieieie.biz' to 21dotco


2016-10-03 01:11:35 UTC-04:00 : +10000 satoshis to your 21.co balance
Description: You sold 'https://mkt.21.co/pagekicker/term-paper-factory/buildtermpaper?key1=The+Scarlet+Letter' to pagekicker

What I find annoying is that there are a lot of extra lines and it is difficult to skim and glance for just the information that I want.  This is a minor concern and it is to be hoped that someone will propose some “pretty print” patches to the open source for 21 log.

In the meantime, I came up with two bash one-liners to help me scan the log output more readily.

The first strips out extra lines and my own test interactions and inverts sort order.

 21 log | grep "Description" | grep -v " MYUSERNAME" | tac

Output:

Description: You sold 'http://[fcce:a977:eef0:ac6d:2715:0000:0000:0001]:6002/?uri=21.co' to 21dotco
Description: You sold 'http://[fcce:a977:eef0:ac6d:2715:0000:0000:0001]:6002/?uri=qpqpqowowowieieie.biz' to 21dotco
Description: You sold 'http://[fcce:a977:eef0:ac6d:2715:0000:0000:0001]:6002/?uri=qpqpqowowowieieie.biz' to 21dotco
Description: You bought 'https://mkt.21.co/21dotco/zip_code_data/zipdata/collect?zip_code=94109' from 21dotco
Description: You sold 'https://mkt.21.co/pagekicker/nevertrump/buy' to joenye

The second one-liner simply produces a list of all the users who have purchased services from me.

 21 log | grep "Description" | grep -v " MYUSERNAME" | grep -v "account." 
| grep -v "bitcoin." | grep -oE '[^ ]+$' | sort -u

Output:

21dotco
_21harding16
bifusingh
binns
...

These one-liners and a few other helper programs are available at https://github.com/fredzannarbor/21-public.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s