mirror of
https://github.com/LukeHagar/VA-Log-Parser.git
synced 2025-12-06 04:21:55 +00:00
Initial commit
This commit is contained in:
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
127
.gitignore
vendored
Normal file
127
.gitignore
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
.cache
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 luke-hagar-sp
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
2
README.md
Normal file
2
README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# VA-Log-Parser
|
||||
Node Module to Parse SailPoint VA logs
|
||||
1
ccg-log-Parsed-Errors.JSON
Normal file
1
ccg-log-Parsed-Errors.JSON
Normal file
@@ -0,0 +1 @@
|
||||
[{"exception":{"stacktrace":"openconnector.InvalidRequestException: [ InvalidRequestException ] \n [ Error details ] Request execution failed. HTTP Error code : 400, Okta Error code : E0000001, errorSummary : Api validation failed: login, errorCauses:[{errorSummary=login: An object with this field already exists in the current organization}].\n\tat openconnector.connector.okta.OktaConnector$OktaHttpClient.setResponseBody(OktaConnector.java:6548)\n\tat openconnector.connector.okta.OktaConnector$OktaHttpClient.fetchHttpResponse(OktaConnector.java:6261)\n\tat openconnector.connector.okta.OktaConnector.doRestRequest(OktaConnector.java:5915)\n\tat openconnector.connector.okta.OktaConnector.createAccount(OktaConnector.java:1445)\n\tat openconnector.connector.okta.OktaConnector.create(OktaConnector.java:828)\n\tat openconnector.AbstractConnector.provision(AbstractConnector.java:664)\n\tat sailpoint.connector.OpenConnectorAdapter.provision(OpenConnectorAdapter.java:999)\n\tat sailpoint.connector.ConnectorProxy.provision(ConnectorProxy.java:1116)\n\tat com.sailpoint.ccg.cloud.container.Container.provision(Container.java:310)\n\tat com.sailpoint.ccg.cloud.container.ContainerIntegration.provision(ContainerIntegration.java:156)\n\tat com.sailpoint.ccg.handler.ProvisionHandler.invoke(ProvisionHandler.java:190)\n\tat sailpoint.gateway.accessiq.CcgPipelineMessageHandler.handleMessage(CcgPipelineMessageHandler.java:26)\n\tat com.sailpoint.pipeline.server.PipelineServer$InboundQueueListener$MessageHandler.run(PipelineServer.java:369)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat java.lang.Thread.run(Thread.java:748)\n","exception_class":"openconnector.InvalidRequestException","exception_message":"[ InvalidRequestException ] \n [ Error details ] Request execution failed. HTTP Error code : 400, Okta Error code : E0000001, errorSummary : Api validation failed: login, errorCauses:[{errorSummary=login: An object with this field already exists in the current organization}]."},"stack":"ccg","pod":"stg01-useast1","connector-logging":"144","Operation":"Create","clusterId":"1467","buildNumber":"737","apiUsername":"32d86f12-ee16-48eb-8c7c-cc6da35f914e","ObjectType":"account","orgType":"development","file":"OktaConnector.java","encryption":"1266","messageType":"provision","connector-bundle-identityiq":"172","line_number":833,"@version":1,"CB_version":"535","logger_name":"openconnector.connector.okta.OktaConnector","mantis-client":"1266","class":"openconnector.connector.okta.OktaConnector","ParentOperation":"ProvisioningOperation","clientId":"4575","request_milliseconds":"3783","source_host":"c3ec057d0168","method":"create","org":"inspirebrands-sb","level":"ERROR","IdentityIQ":"8.0 Build 2f61d76cf47-20220429-140148","message":"Failed to create the account. ","pipeline":"1266","@timestamp":"2022-08-09T04:47:44.321Z","NativeIdentity":"70000054","thread_name":"pool-5-thread-1","metrics":"1266","region":"us-east-1","AppType":"Okta","Application":"Okta [source]","request_id":"8e60f60b7f4f4768b5df3d29f4ee1e0f","CB_Type":"connector-bundle-webservices","queue":"stg01-useast1-inspirebrands-sb-cluster-1467","SCIM Common":"8.0 Build 00b1f252d1b-20200225-190809"}]
|
||||
1
ccg-log-Parsed.JSON
Normal file
1
ccg-log-Parsed.JSON
Normal file
File diff suppressed because one or more lines are too long
39
commands/parseCCG.js
Normal file
39
commands/parseCCG.js
Normal file
@@ -0,0 +1,39 @@
|
||||
import chalk from "chalk";
|
||||
import fs from "fs";
|
||||
|
||||
function importCCG(CCGFile) {
|
||||
const allFileContents = fs.readFileSync(CCGFile, "utf-8");
|
||||
const fileLines = allFileContents.split(/\r?\n/);
|
||||
let jsonArray = [];
|
||||
console.log(fileLines);
|
||||
for (const line of fileLines) {
|
||||
try {
|
||||
let jsonObjFromLine = JSON.parse(line);
|
||||
jsonArray.push(jsonObjFromLine);
|
||||
} catch {
|
||||
console.log("Invalid JSON Found");
|
||||
}
|
||||
}
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
function saveParsedFile(filePath, data) {
|
||||
console.log(`Saving file ${filePath}`);
|
||||
const outputString = JSON.stringify(data);
|
||||
fs.writeFileSync(filePath, outputString);
|
||||
}
|
||||
|
||||
export default function parseCCG(CCGFile) {
|
||||
const jsonArray = importCCG(CCGFile);
|
||||
const errors = jsonArray.filter(
|
||||
(Obj) =>
|
||||
Obj.message?.includes("error") ||
|
||||
Obj.exception?.stacktrace?.includes("error")
|
||||
);
|
||||
console.log(jsonArray);
|
||||
console.log(errors);
|
||||
const parsedDataPath = `${CCGFile.replace(".log", "-log")}-Parsed.JSON`;
|
||||
const errorPath = `${CCGFile.replace(".log", "-log")}-Parsed-Errors.JSON`;
|
||||
saveParsedFile(parsedDataPath, jsonArray);
|
||||
saveParsedFile(errorPath, errors);
|
||||
}
|
||||
9
index.js
Executable file
9
index.js
Executable file
@@ -0,0 +1,9 @@
|
||||
#! /usr/bin/env node
|
||||
import { program } from "commander";
|
||||
import parseCCG from "./commands/parseCCG.js";
|
||||
program
|
||||
.command("parseCCG <CCGFile>")
|
||||
.description("Parse the Provided CCG Log File")
|
||||
.action(parseCCG);
|
||||
|
||||
program.parse();
|
||||
59
package-lock.json
generated
Normal file
59
package-lock.json
generated
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"name": "va-log-parser",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "va-log-parser",
|
||||
"version": "0.0.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chalk": "^5.0.1",
|
||||
"commander": "^9.4.0",
|
||||
"fs": "^0.0.1-security"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz",
|
||||
"integrity": "sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==",
|
||||
"engines": {
|
||||
"node": "^12.17.0 || ^14.13 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "9.4.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-9.4.0.tgz",
|
||||
"integrity": "sha512-sRPT+umqkz90UA8M1yqYfnHlZA7fF6nSphDtxeywPZ49ysjxDQybzk13CL+mXekDRG92skbcqCLVovuCusNmFw==",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/fs": {
|
||||
"version": "0.0.1-security",
|
||||
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
|
||||
"integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz",
|
||||
"integrity": "sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w=="
|
||||
},
|
||||
"commander": {
|
||||
"version": "9.4.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-9.4.0.tgz",
|
||||
"integrity": "sha512-sRPT+umqkz90UA8M1yqYfnHlZA7fF6nSphDtxeywPZ49ysjxDQybzk13CL+mXekDRG92skbcqCLVovuCusNmFw=="
|
||||
},
|
||||
"fs": {
|
||||
"version": "0.0.1-security",
|
||||
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
|
||||
"integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
|
||||
}
|
||||
}
|
||||
}
|
||||
20
package.json
Normal file
20
package.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "va-log-parser",
|
||||
"version": "0.0.2",
|
||||
"description": "A Log Parser for SailPoint VA logs",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"bin": {
|
||||
"parse-va-log": "./index.js"
|
||||
},
|
||||
"author": "Luke Hagar",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chalk": "^5.0.1",
|
||||
"commander": "^9.4.0",
|
||||
"fs": "^0.0.1-security"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user