コード例 #1
0
        public override IPluginResponse Execute(IPluginRequest pluginRequest)
        {
            //Set member variables for execution.
            this.pluginRequest     = pluginRequest;
            this.logsetHash        = pluginRequest.LogsetHash;
            this.pluginResponse    = CreatePluginResponse();
            this.workerHostnameMap = ConfigDataHelper.GetWorkerHostnameMap(MongoDatabase);

            // Create output database.
            using (var outputDatabase = GetOutputDatabaseConnection())
            {
                CreateTables(outputDatabase);
            }

            //Process collections.
            ProcessCollections(GetMongoCollections());

            // Check if we persisted any data.
            if (!PersistedData())
            {
                Log.Info("Failed to persist any data from Vizqlserver logs!");
                pluginResponse.GeneratedNoData = true;
            }

            return(pluginResponse);
        }
コード例 #2
0
ファイル: Netstat.cs プロジェクト: geanttechnology/Logshark
        public override IPluginResponse Execute(IPluginRequest pluginRequest)
        {
            pluginResponse = CreatePluginResponse();

            Log.Info("Retrieving configuration information for workers..");
            workerHostnameMap = ConfigDataHelper.GetWorkerHostnameMap(MongoDatabase);

            netstatCollection = MongoDatabase.GetCollection <BsonDocument>(NetstatCollectionName);

            logsetHash = pluginRequest.LogsetHash;

            List <NetstatEntry> netstatEntries = new List <NetstatEntry>();

            foreach (int workerIndex in workerHostnameMap.Keys)
            {
                Log.InfoFormat("Retrieving netstat information for worker {0}..", workerIndex);
                IEnumerable <NetstatEntry> entriesForWorker = GetNetstatEntriesForWorker(workerIndex);
                netstatEntries.AddRange(entriesForWorker);
            }

            Log.InfoFormat("Writing netstat information to database..");
            CreateTables();
            PersistNetstatEntries(netstatEntries);

            Log.Info("Finished processing netstat data!");

            // Check if we persisted any data.
            if (!PersistedData())
            {
                Log.Info("Failed to persist any netstat data!");
                pluginResponse.GeneratedNoData = true;
            }

            return(pluginResponse);
        }
コード例 #3
0
ファイル: ConfigReader.cs プロジェクト: yuhonghong66/Logshark
 public ConfigReader(IMongoDatabase mongoDatabase)
 {
     this.mongoDatabase        = mongoDatabase;
     configDocument            = LoadConfigDocument();
     config                    = LoadConfig();
     fileLastModifiedTimestamp = GetConfigModificationTimestamp();
     workerHostnameMap         = ConfigDataHelper.GetWorkerHostnameMap(mongoDatabase);
 }
コード例 #4
0
ファイル: VizqlServer.cs プロジェクト: yuhonghong66/Logshark
        protected virtual bool ProcessCollections(IList <IMongoCollection <BsonDocument> > collections)
        {
            var workerHostnameMap  = ConfigDataHelper.GetWorkerHostnameMap(MongoDatabase);
            var totalVizqlSessions = Queries.GetUniqueSessionIdCount(collections);

            using (var persister = new ServerSessionPersister(ExtractFactory))
                using (GetPersisterStatusWriter(persister, totalVizqlSessions))
                {
                    foreach (var collection in collections)
                    {
                        ProcessCollection(collection, persister, workerHostnameMap);
                    }

                    return(persister.ItemsPersisted > 0);
                }
        }