
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Log2JSON is a small lib that allows you to transform nginx/apache/whatever logs to JSON.
Install it will npm / cnpm:
$ npm install log2json
Run it like:
var log2json = require('log2json');
log2json(configure, ret => {
if(!ret) return console.log('the file is empty');
console.log('JSON is generated: %s', ret);
});
Follow the codes below to generate the configure
object.
var path = require('path');
var separator = '•-•'; // separator of the log
var src = path.join(__dirname, './log'); // path of the log
var dist = path.join(__dirname, './log.json'); // the generated JSON file
var removeSrc = true; // remove the log when JSON is
// generated, by default is true
var map = [ // map the fields with keys
'fieldName2', // 1. {string} name to the filed
fn2TransformData, // 2. a custom function to transform the field
// should return an object {name, value}
'fieldName|number', // 3. use built-in directive to
// transform the field
'fieldName|url', // built-in directives: number, url, array
'fieldName|array' // - `number` transform string to number
// - `array` transform 'a,b' to ["a","b"]
// - `url` transform querystring to object
// 'a=b&c[]=d&c[]=e' to {a:"b", c: ["d", "e"]}
];
// a transform function should return an object like {name, value}
function fn2TransformData(input) {
var name = 'transformed';
var value = doSomethingWith(value);
return {name, value};
}
// what we need
var configure = {map, separator, src, dist, removeSrc};
simply run npm test
on your favor terminal app.
FAQs
transform nginx log to JSON
The npm package log2json receives a total of 8 weekly downloads. As such, log2json popularity was classified as not popular.
We found that log2json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.