Python Logging to Logstash Server

Since we are having a problem with some of our filebeat servers actually delivering data over to logstash, I put together a really quick python script that connects to the logstash server and sends a log record. I can then run tcpdump on the logstash server and hopefully see what is going wrong.

import logging
import logstash
import sys

strHost = 'logstash.example.com'
iPort = 5048

test_logger = logging.getLogger('python-logstash-logger')
test_logger.setLevel(logging.INFO)
test_logger.addHandler(logstash.TCPLogstashHandler(host=strHost,port=iPort))

test_logger.info('May 22 23:34:13 ABCDOHEFG66SC03 sipd[3863cc60] CRITICAL One or more Dns Servers are currently unreachable!')
test_logger.warning('May 22 23:34:13 ABCDOHEFG66SC03 sipd[3863cc60] CRITICAL One or more Dns Servers are currently unreachable!')
test_logger.error('May 22 23:34:13 ABCDOHEFG66SC03 sipd[3863cc60] CRITICAL One or more Dns Servers are currently unreachable!')

Bee Check-in

We checked on our bees this afternoon — it was a nice, hot day (low 80’s!). We turned the entrance reducer to give them more space to come and go. I frequently saw bee traffic jams! We removed the queen cage and some burr comb the bees had built up between the two frames where the queen cage was placed. I’d given them a gallon of sugar water when we installed the package, and there’s a bit left. But they’ve consumed a lot of the syrup. We’ll have to refill their food when it warms up again next week.

Bees, again!

I’d ordered a package of bees this year (we’ve got frames from last year that will give them a good head start), but the post office seemed to have lost them. They left Kentucky over the weekend and went into “umm … the package is on its way to the destination. Check back later” status. But, at about 6:30 this morning, the post office rang me up to let me know they had bees for me. I picked up the package and set them in the butler pantry (a nice, dark, quiet place!) and we put the bees in their hive at about 3PM.

Using urandom to Generate Password

Frequently, I’ll use password generator websites to create some pseudo-random string of characters for system accounts, database replication,etc. But sometimes the Internet isn’t readily available … and you can create a decent password right from the Linux command line using urandom.

If you want pretty much any “normal” character, use tr to pull out all of the other characters:

'\11\12\40-\176'

Or remove anything outside of upper case, lower case, and number characters using

a-zA-Z0-9

Pass the output to head to grab however many characters you actually want. Voila — a quick password.

New hatchling count

Started with 19 chicken eggs in the incubator — two didn’t develop and were removed. Three eggs haven’t hatched (three of those have pipped, but haven’t really gotten anywhere since). One little guy is really weak and still in the incubator so the other little ones don’t sit and lay on him. That means we’ve got a thirteen little chickens in the brooder. And, early next week, the ducks should start hatching.