The 15th field of our Apache log is the application server session ID. We truncate the _time field to minute, and get a distinct count of sessions in each minute. The number is 14 below because the source array is…
Author: Steve
Java garbage collection stats
jstat -gcutil -t 18987 1000 where 18987 is the java PID, and 1000 is the number of milliseconds (1 second) between samples 896794.7 0.00 0.00 4.01 5.63 98.94 9259 282.051 250 336.211 618.262 896795.7 0.00 0.00 5.31 5.63 98.94 9259…
Splunk query to group URI request by first three IP address octets
We needed this to understand the source of a large influx of requests for a given URI pattern. import splunklib.client as client import splunklib.results as results service = client.connect(host=”*******”,port=”8089″,username=”showard”,password=”************”) job = “”” search host=\”cmhlpecomweb*\” sourcetype=access_combined karlie-kloss | eval temp=split(_raw,\”\t\”) |…
Pushing a file to Oracle database to write to database filesystem
import java.sql.*; import java.io.*; public class sendFile { public static void main (String args[]) throws Exception { File file = new File(“a.txt”); FileInputStream fis = new FileInputStream(file); byte[] data = new byte[(int)file.length()]; fis.read(data); fis.close(); String s = new String(data, “UTF-8”);…
Splunk query for custom Apache access log format
We have a kludgy access log format. It certainly isn’t standard. At any rate, the out of the box transforms.conf can’t handle it. Rather than change that, I elected to split the lines on the fly; not as fast, but…
Finding large prime numbers with python
This post will provide how to calculate the largest prime number of a 96 bit number. This was chosen as a starting point. As you can see, it took almost 27 minutes (1614 seconds) to calculate on a dual core…
Does NodeJS have a socket per connection, even though it is single threaded?
Yes. We start with our express module running our server at port 8080. We show there are no connections… [esb@cmhlcarchapp01 fuse]$ netstat -anp | grep 8080 tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN – [esb@cmhlcarchapp01 fuse]$ …and then run from our…
awk date math
Just a reference post for how to determine the number of seconds between two date strings in awk. If you have a normally formatted date string in Linux, such as “Sun Mar 19 00:50:33 EDT 2017”, you can convert this…
Searching splunk and analyzing results with PyDbLite
We had a need to analyze how often a web shopper used more than one device to manage her shopping cart within a given time tolerance. We store our Apache access logs in Splunk, so this post is simply a…
Adding a system call to Linux
These are *old* notes (2010 or so). I remember doing this, and it was interesting enough that I thought I should post it. It may be easier now. I experimented with the following on CentOS 5.1 running on an i686…