Phasor Burn

Warning: Do not look into phasor with remaining eye.

About

Yet another collection of random links and rantings of a greying unix geek with a photography bent. Pass the Guinness and Grecian Formula.

Archive for the 'System Administration' Category

Quick and dirty email traffic count

Friday, September 30th, 2011

A bit of log file analysis 101

Say you want to get a rough idea of how many email messages are being sent per minute at peak periods, and you just have the raw log file to work with.

In /var/log/messages you might have lines that look like this for each message successfully sent.

Sep 30 12:21:15 localhost postfix/smtp[12519]: 2C46876021B: to=<april.smith@example.com>, relay=172.16.15.20[172.16.15.20]:25, delay=0.18, delays=0.04/0/0/0.13, dsn=2.6.0, status=sent (250 2.6.0 <924313460.6041.1317406875180.JavaMail.jira@jira-prod> Queued mail for delivery)

Let’s break it down. First grab just the status=sent lines, and run it thru head to limit the output for now.

$ sudo cat /var/log/maillog | grep status=sent | head

Examine the result, looks like the lines you want? Good.

Next, print just the date stamp for each of those lines. We only want Month, Day, Hour, and Minute.

Here I take advantage of using the colon as field separator.

$ sudo cat /var/log/maillog | grep status=sent | awk -F: '{print $1" "$2 }' | head
Sep 25 08 04
Sep 25 08 04
Sep 26 04 02
Sep 26 11 41
Sep 26 11 43
Sep 26 11 43
Sep 26 11 43
Sep 26 11 43
Sep 26 11 43
Sep 26 11 43

Result look like what you want? No? tweak until it does. I want a colon between the hour and minutes.

$ sudo cat /var/log/maillog | grep status=sent | awk -F: '{print $1":"$2 }' | head

Sep 25 08:04
Sep 25 08:04
Sep 26 04:02
Sep 26 11:41
Sep 26 11:43
Sep 26 11:43
Sep 26 11:43
Sep 26 11:43
Sep 26 11:43
Sep 26 11:43

Now, count how many of each date stamp.

$ sudo cat /var/log/maillog | grep status=sent | awk -F: '{print $1":"$2 }' | sort | uniq -c | head

2 Sep 25 08:04
1 Sep 26 04:02
1 Sep 26 11:41
240 Sep 26 11:43
828 Sep 26 11:44
962 Sep 26 11:45
26 Sep 26 11:47
9 Sep 26 11:48
18 Sep 26 11:50
10 Sep 26 11:51

Alright, we’re nearly there. I’m interested in the peaks, remember. So lets just say anything over 99 is a peak.
You probably don’t need the sort as the log file was already sorted.

$ sudo cat /var/log/maillog | grep status=sent | awk -F: '{print $1":"$2 }' | uniq -c | awk '$1 > 99 {print}'
240 Sep 26 11:43
828 Sep 26 11:44
962 Sep 26 11:45
447 Sep 26 11:55
2058 Sep 26 11:57
180 Sep 26 12:11
187 Sep 26 12:26
126 Sep 26 14:07
132 Sep 26 15:07
156 Sep 26 16:08
132 Sep 27 06:07
120 Sep 27 10:05
143 Sep 27 11:07
101 Sep 27 11:24
114 Sep 27 12:05
125 Sep 27 14:06
155 Sep 27 15:05
262 Sep 28 09:06
126 Sep 28 10:06
115 Sep 28 11:04
239 Sep 28 14:06
151 Sep 28 16:05
100 Sep 28 18:27
108 Sep 29 06:06
118 Sep 29 08:25
152 Sep 29 09:06
126 Sep 29 10:04
102 Sep 29 11:07
144 Sep 29 11:25
134 Sep 29 12:06
210 Sep 29 15:06
101 Sep 30 06:05
105 Sep 30 08:43
233 Sep 30 09:06

That’s all I was interested in this time.

Easy Peasy. Just build your command line pipe line one bit at a time until you’ve got what you’re looking for.

Escape from The Cloud

Monday, September 26th, 2011

I feel like I’m wanting to move in the opposite direction of ‘the cloud’.

I actually have some interest in landing an opportunity to work with the Z mainframe stuff (which I think can run AIX and Linux inside of LPAR or something). It’s not very likely to happen, but still.

I don’t know exactly why I want to do this.

Perhaps leveraging existing os and platform stability vs designing/implementing for constant chaos-monkey action is part of it.

The older I get, the less risk for ‘exciting times’ I seem to want to take on. The less I care about actual geeky bits and the more I want to just leverage my income for enabling my photography hobby, taking time to do other things, etc.

Must be my mid life crisis creeping up on me again. Must also be why I’m working in financial services industry right now. Hmm. :)

How Modern Dinosaurs Are Made.

Friday, September 23rd, 2011

Head hunters continue to scrape the bottom of their barrels, by contacting me for AIX positions that keep coming up (or are re-listed). They know, or should know, I haven’t touched AIX in any serious way since the 90s, AIX 4.3 or thereabouts.

They should also know that I’m not looking. Nice to feel wanted I suppose.

That being said, I do kinda miss the jack-boots that came with AIX. This tinker toy Linux stuff is fun at times but not very enterprisey.

I guess if talent with that tech is so scarce I could consider finding more out about it, and give them extortion level rates…. to see what they would do.

Just like the COBOL Y2K remediation guys did in 1998-1999.

Wait, does that make me the same as the COBOL dinosaurs? o_O

Flash Abuse

Monday, September 12th, 2011

Today I happened across the following website

icy-1.png

What’s behind all those flash blocked objects you may ask?

icy-2.png

Clickable Images!

WTF!? What’s wrong with IMG and A tags?

Flash Abuse has definitely rotted some web designers brain completely out.

Blog Comment Spammers

Monday, August 29th, 2011

I’ve noticed a trend recently, that the blog comment spam sitting in the moderation queue seems to be written by humans.

I did some digging and found some online job boards that advertise for people to do this sort of thing. They ask that you read a blog posting, write a somewhat relevant on topic reply, and slip in mention and links to the product they are trying to flog.

It isn’t going to work here, people.

All comments go to moderation queue, and it’s brain dead easy to see which ones are spam comments and which are valid. Delete Delete Delete.

Just deleted 853 of them a few minutes ago. Wheeeee!