Ejemplo n.º 1
0
 protected BasicLogFinder(SenseLogMasterBaseType logMasterBaseType, SenseLogBaseTypes senseLogBaseTypes, SenseLogSubTypes logSubType, DirectorySetting directory)
 {
     LogMasterBaseType = logMasterBaseType;
     LogBaseTypes      = senseLogBaseTypes;
     LogSubTypes       = logSubType;
     Directory         = directory;
 }
        public void LoadAndRead(DirectorySetting[] directories, CommonCollectorServiceVariables settings)
        {
            _settings = settings;

            if (!settings.GetLogsScripting)
            {
                _ignoredFiles = SenseLogBaseTypes.Script;
            }

            var cts = new CancellationTokenSource();
            var cancellationToken = cts.Token;

            _folderNotificationHelper = new FolderNotificationHelper(_logger, _notify, NotificationKey, _settings);

            Task.Run(async() =>
            {
                while (true)
                {
                    await Task.Delay(TimeSpan.FromSeconds(3), cancellationToken);
                    _folderNotificationHelper.Analyze(_localFileCounter, _localDirCounter);
                    if (cancellationToken.IsCancellationRequested)
                    {
                        break;
                    }
                }
            }, cancellationToken);


            foreach (DirectorySetting directory in directories)
            {
                CrawlAllLogBaseDirectories(directory);
            }
            cts.Cancel();
            //_onLogDirectorFinishedReading?.Invoke(this);
        }
Ejemplo n.º 3
0
        public override List <FileInfo> FindFiles(DateTime from, DateTime to, SenseLogBaseTypes acceptedFiles)
        {
            var dateMatched = GetFiles(from, to);
            var ret         = new List <FileInfo>();

            if (acceptedFiles == SenseLogBaseTypes.Unknown)
            {
                return(dateMatched);
            }
            foreach (FileInfo fi in dateMatched)
            {
                //if(!(IsEpochAtStart(fi.Name) && fi.Extension == ".log"))
                //    continue;
                //if (acceptedFiles == LogFilePatterns.NodeJs_AppMigractionAndGuid  && fi.Name.Substring(23) == "-"
                //    ||
                //    acceptedFiles == LogFilePatterns.NodeJs_AppMigrationGlobal && fi.Name.Substring(13, 7) == "_Global"
                //    ||
                //    acceptedFiles == LogFilePatterns.NodeJs_AppMigrationRequest  && fi.Name.Substring(13, 8) == "_Request")
                {
                    ret.Add(fi);
                }
            }
            Files = ret;
            return(ret);
        }
Ejemplo n.º 4
0
 public NodeJsV1LogFolder(DirectorySetting directory, SenseLogBaseTypes senseLogBaseTypes, SenseLogSubTypes logSubType) : base(SenseLogMasterBaseType.NodeJsV1, senseLogBaseTypes, logSubType, directory)
 {
     //Severity= info
     //Date =2015-10-15T15:12:37.304Z
     //1444921956216_969c2051-f159-4bac-a233-33bab93e0798.log
     //1444921956216_Global.log
     //1444921956216_Request.log
     //Is file within date span
 }
        //do something cool to remove this.. this is just a temp hack.. Im tired today..
        //I did!!! finally 1 year afterwards...
        public BasicLogFinder Get(SenseLogBaseTypes baseType, SenseLogSubTypes subType, DirectorySetting dir)
        {
            switch (baseType)
            {
            case SenseLogBaseTypes.AppMigration:
            case SenseLogBaseTypes.Script:
            case SenseLogBaseTypes.BrokerService:
            case SenseLogBaseTypes.DataProfiling:
            case SenseLogBaseTypes.HubService:
            case SenseLogBaseTypes.AboutService:
            case SenseLogBaseTypes.CapabilityService:
            case SenseLogBaseTypes.ConnectorRegistryProxy:
            case SenseLogBaseTypes.ConverterService:
            case SenseLogBaseTypes.DepGraphService:
            case SenseLogBaseTypes.DownloadPrepService:
            case SenseLogBaseTypes.OdagService:
            case SenseLogBaseTypes.WebExtensionService:
            case SenseLogBaseTypes.HybridSetupConsoleBff:
            case SenseLogBaseTypes.ResourceDistributionService:
            case SenseLogBaseTypes.DeploymentBasedWarningsService:

                //1444921956216_969c2051-f159-4bac-a233-33bab93e0798.log whoahhahah we are susceptible to the year 2286 problem...
                //1444921956216_Global.log
                //1444921956216_Request.log
                return(new NodeJsV1LogFolder(dir, baseType, SenseLogSubTypes.RootFolder));

            case SenseLogBaseTypes.Engine:
            case SenseLogBaseTypes.Proxy:
            case SenseLogBaseTypes.Printing:
            case SenseLogBaseTypes.Repository:
            case SenseLogBaseTypes.Scheduler:
            case SenseLogBaseTypes.AppDistributionService:         // Todo: Bugreport this log. Its just horrible.
            case SenseLogBaseTypes.EntitlementProvisioningService: // Todo: Bugreport this log. Its just horrible.
            case SenseLogBaseTypes.HybridDeploymentService:        // Todo: Bugreport this log. Its just horrible.
                switch (subType)
                {
                case SenseLogSubTypes.Audit:
                    return(new SenseV1LogFolder(dir, baseType, subType));

                case SenseLogSubTypes.System:
                    return(new SenseV1LogFolder(dir, baseType, subType));

                case SenseLogSubTypes.Trace:
                    return(new SenseV1LogFolder(dir, baseType, subType));

                default:
                    return(new SenseV1LogFolder(dir, SenseLogBaseTypes.Unknown, subType));
                }

            default:
                return(null);
            }
        }
Ejemplo n.º 6
0
        public override List <FileInfo> FindFiles(DateTime from, DateTime to, SenseLogBaseTypes acceptedFiles)
        {
            var dateMatched = GetFiles(from, to);
            var ret         = new List <FileInfo>();

            if (acceptedFiles == SenseLogBaseTypes.Unknown)
            {
                return(dateMatched);
            }

            foreach (FileInfo fi in dateMatched)
            {
                ret.Add(fi);
            }
            Files = ret;
            return(ret);
        }
Ejemplo n.º 7
0
 public ScriptV1LogFolder(DirectorySetting directory, SenseLogBaseTypes senseLogBaseTypes, SenseLogSubTypes logSubType) : base(SenseLogMasterBaseType.ScriptV1, senseLogBaseTypes, logSubType, directory)
 {
 }
Ejemplo n.º 8
0
 public abstract List <FileInfo> FindFiles(DateTime from, DateTime to, SenseLogBaseTypes acceptedFiles);