Skip to content

Instantly share code, notes, and snippets.

@millzpaugh
Created July 26, 2018 16:07
Show Gist options
  • Save millzpaugh/dcb5d99d04284c310fc2ce2f21d2cde6 to your computer and use it in GitHub Desktop.
Save millzpaugh/dcb5d99d04284c310fc2ce2f21d2cde6 to your computer and use it in GitHub Desktop.
parses aws elb logs to filter out non-composite requests
let count = 0;
fs.readFileSync('./07-11-log-pull.log').toString().split('\n').forEach(function (l) {
try{
const tsvFile = /(?<=GET).*$/;
const d = tsvFile.exec(l);
if (d) {
const v = d[0].split(' ')[1].split('/')[4];
const mapidCount = v ? v.split(',').length : 0;
if (mapidCount > 1){
count+=1;
console.log('count!', count);
fs.appendFileSync("./07-11-composite-requests.log", l + "\n");
}
}
} catch(e){
console.log('ERROR', e);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment