Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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.
//
/* jshint unused: true */
var splunkjs = require("splunk-sdk");
var ModularInputs = splunkjs.ModularInputs;
var ModularInput = ModularInputs.ModularInput;
var Logger = ModularInputs.Logger;
var path = require('path');
var fs = require('fs');
exports.getCheckpoints = function (name) {
var checkpointFileName = getCheckpointFileName(name);
var checkpointsData = "{}";
try {
//Logger.debug(name, 'Reading contents of checkpoint file.');
checkpointsData = fs.readFileSync(checkpointFileName, 'utf8');
} catch (err) {
if (err.code === 'ENOENT') { }
else {
(function () {
var splunkjs = require("splunk-sdk");
var ModularInputs = splunkjs.ModularInputs;
var logs = require('./azure_monitor_logs');
exports.getScheme = function () {
var schemeName = 'Azure Monitor Diagnostic Logs';
var schemeDesc = 'Diagnostic Logs obtained via Azure Monitor.';
return logs.getScheme(schemeName, schemeDesc);
};
// validateInput method validates the script's configuration (optional)
exports.validateInput = function (definition, done) {
done();
};
exports.streamEvents = function (name, singleInput, eventWriter, done) {
(function() {
var fs = require("fs");
var path = require("path");
var GithubAPI = require("github");
var splunkjs = require("splunk-sdk");
var Async = splunkjs.Async;
var ModularInputs = splunkjs.ModularInputs;
var Logger = ModularInputs.Logger;
var Event = ModularInputs.Event;
var Scheme = ModularInputs.Scheme;
var Argument = ModularInputs.Argument;
var utils = ModularInputs.utils;
// The version number should be updated every time a new version of the JavaScript SDK is released.
var SDK_UA_STRING = "splunk-sdk-javascript/1.9.0";
// Create easy to read date format.
function getDisplayDate(date) {
var monthStrings = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
date = new Date(date);
var hours = date.getHours();
// 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.
/* jshint unused: true */
var splunkjs = require("splunk-sdk");
var ModularInputs = splunkjs.ModularInputs;
var ModularInput = ModularInputs.ModularInput;
var Logger = ModularInputs.Logger;
var Scheme = ModularInputs.Scheme;
var Event = ModularInputs.Event;
var Argument = ModularInputs.Argument;
var _ = require('underscore');
var AMQPClient = require('amqp10').Client;
var Policy = require('amqp10').Policy;
var Promise = require('bluebird');
var subs = require('./subs');
var strings = require('./strings');
strings.stringFormat();
var allHubs = require('./hubs.json');
var categories = require('./logCategories.json');
(function () {
var splunkjs = require("splunk-sdk");
var ModularInputs = splunkjs.ModularInputs;
var logs = require('./azure_monitor_logs');
exports.getScheme = function () {
var schemeName = 'Azure Monitor Activity Log';
var schemeDesc = 'Activity Log (aka Audit Log) obtained via Azure Monitor.';
return logs.getScheme(schemeName, schemeDesc);
};
// validateInput method validates the script's configuration (optional)
exports.validateInput = function (definition, done) {
done();
};
// streamEvents streams the events to Splunk Enterprise
exports.streamEvents = function (name, singleInput, eventWriter, done) {
process.env.SPLUNK_DB = 'c:/github/SplunkAddonForAzureMonitorLogs';
var splunkjs = require("splunk-sdk");
var ModularInputs = splunkjs.ModularInputs;
var Logger = ModularInputs.Logger;
var _ = require('underscore');
var logs = require('./amdl');
var subs = require('./subs');
var strings = require('./strings');
strings.stringFormat();
singleInput = require('./singleInput.json');
var name = 'azure_diagnostic_logs://GOLIVE-Azure';
var messageHandler = function (data) {
var dataAsString = JSON.stringify(data);
if (dataAsString.length > 10000) {
(function() {
var splunkjs = require("splunk-sdk");
var ModularInputs = splunkjs.ModularInputs;
var Logger = ModularInputs.Logger;
var Event = ModularInputs.Event;
var Scheme = ModularInputs.Scheme;
var Argument = ModularInputs.Argument;
var utils = ModularInputs.utils;
exports.getScheme = function() {
var scheme = new Scheme("Random Numbers");
scheme.description = "Streams events containing a random number.";
scheme.useExternalValidation = true;
scheme.useSingleInstance = true;
scheme.args = [
new Argument({
name: "min",
(function () {
var splunkjs = require("splunk-sdk");
var ModularInputs = splunkjs.ModularInputs;
var Logger = ModularInputs.Logger;
var Event = ModularInputs.Event;
var Scheme = ModularInputs.Scheme;
var Argument = ModularInputs.Argument;
var rp = require('request-promise');
var _ = require('underscore');
var AMQPClient = require('amqp10').Client;
var Policy = require('amqp10').Policy;
var Promise = require('bluebird');
var adal = require('adal-node');
var path = require('path');
var subs = require('./subs');
var config = require('./config.json');