// // ConfigInputDetailInfo.cs // // Author: // MiNG // // Copyright (c) 2018 Alibaba Cloud // // 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. using System; using System.Collections.Generic; using System.Linq; namespace Aliyun.Api.LogService.Domain.Config { public class ConfigInputDetailInfo { public const Boolean DefaultPreserve = true; /// /// 日志类型,现在只支持 common_reg_log。 /// public String LogType { get; } /// /// 日志所在的父目录,例如 /var/logs/。 /// public String LogPath { get; } /// /// 日志文件的Pattern,例如 access*.log。 /// public String FilePattern { get; } /// /// 是否打开本地缓存,在服务端之间链路断开的情况下,本地可以缓存 1GB 日志。 /// public Boolean LocalStorage { get; } /// /// 日志时间格式, 如 %Y/%m/%d %H:%M:%S。 /// public String TimeFormat { get; } /// /// 日志首行特征(正则表达式),由于匹配多行日志组成一条 log 的情况。 /// public String LogBeginRegex { get; } /// /// 日志对提取正则表达式。 /// public String Regex { get; } /// /// 日志提取后所生成的 Key。 /// public IList Key { get; } /// /// 用于过滤日志所用到的 key,只有 key 的值满足对应 filterRegex 列中设定的正则表达式日志才是符合要求的。 /// public IList FilterKey { get; } /// /// 和每个 filterKey 对应的正则表达式, filterRegex 的长度和 filterKey 的长度必须相同。 /// public IList FilterRegex { get; } /// /// Topic 生成方式,支持以下四种类型: /// /// 用于将日志文件路径的某部分作为 topic,如 /var/log/(.*).log。 /// none,表示 topic 为空。 /// default,表示将日志文件路径作为 topic。 /// group_topic,表示将应用该配置的机器组 topic 属性作为 topic。 /// /// public String TopicFormat { get; set; } /// /// true 代表监控目录永不超时,false 代表监控目录 30 分钟超时,默认值为 true。 /// public Boolean Preserve { get; set; } = DefaultPreserve; /// /// 当设置 preserve 为 false 时,指定监控不超时目录的深度,最大深度支持 3。 /// public Int32 PreserveDepth { get; set; } /// /// 支持两种类型:utf8、gbk。 /// public String FileEncoding { get; set; } public ConfigInputDetailInfo(String logType, String logPath, String filePattern, Boolean localStorage, String timeFormat, String logBeginRegex, String regex, IEnumerable key, IEnumerable filterKey, IEnumerable filterRegex) { this.LogType = logType; this.LogPath = logPath; this.FilePattern = filePattern; this.LocalStorage = localStorage; this.TimeFormat = timeFormat; this.LogBeginRegex = logBeginRegex; this.Regex = regex; this.Key = key?.ToList(); this.FilterKey = filterKey?.ToList(); this.FilterRegex = filterRegex?.ToList(); } } }