Documentation ¶
Index ¶
- Constants
- Variables
- func GetCurPath() string
- func RegisterRule(fieldname string, r []Rule)
- type AutoRemoval
- type BlackList
- type Encoding
- type FileConfig
- type FilePath
- type FromBeginning
- type LogConfig
- type LogFilter
- type LogGroupName
- type LogStreamName
- type MultiLineStartPattern
- type OutputLogConfigFile
- type Pipe
- type PublishMultiLogs
- type RetentionInDays
- type Rule
- type TimestampLayout
- type TimestampRegex
- type Timezone
Constants ¶
const ( FiltersSectionKey = "filters" FiltersTypeSectionKey = "type" FiltersExpressionSectionKey = "expression" )
const AutoRemovalSectionKey = "auto_removal"
const BlacklistSectionKey = "blacklist"
const EncodingSectionKey = "encoding"
const LogGroupNameSectionKey = "log_group_name"
const PublishMultiLogsSectionKey = "publish_multi_logs"
const RetentionInDaysSectionKey = "retention_in_days"
const (
SectionKey = "collect_list"
)
Variables ¶
var ChildRule = map[string][]Rule{}
var Index = 0
var MergeRuleMap = map[string]mergeJsonRule.MergeRule{}
var TimeFormatMap = map[string]string{
"%B": "January",
"%b": "Jan",
"%-m": "1",
"%m": "01",
"%A": "Monday",
"%a": "Mon",
"%-d": "_2",
"%d": "_2",
"%H": "15",
"%-I": "3",
"%I": "03",
"%-M": "4",
"%M": "04",
"%-S": "5",
"%S": "05",
"%Y": "2006",
"%y": "06",
"%p": "PM",
"%Z": "MST",
"%z": "-0700",
"%f": ".000",
}
The reference time used in the layouts in Golang is the specific time. For example : "Mon Jan 2 15:04:05 MST 2006"
So the TimeFormatMap records time_format code and its corresponding Golang specific reference time. And the TimeFormatRexMap records time_format code and its corresponding regax expression. When process the user's input, the translator will translate the timestamp_format into the Golang reference time layout and the regax expression based on those two maps.
Based on https://golang.org/src/time/format.go and http://strftime.org/, here is the mapping below: stdLongMonth // "January" //%B stdMonth // "Jan" //%b stdNumMonth // "1" //%-m stdZeroMonth // "01" //%m stdLongWeekDay // "Monday" //%A stdWeekDay // "Mon" //%a stdDay // "2" //%-d stdUnderDay // "_2" // stdZeroDay // "02" //%d stdHour // "15" //%H stdHour12 // "3" //%-I stdZeroHour12 // "03" //%I stdMinute // "4" //%-M stdZeroMinute // "04" //%M stdSecond // "5" //%-S stdZeroSecond // "05" //%S stdLongYear // "2006" //%Y stdYear // "06" //%y stdPM // "PM" //%p stdpm // "pm" // stdTZ // "MST" //%Z stdISO8601TZ // "Z0700" // prints Z for UTC stdISO8601SecondsTZ // "Z070000" stdISO8601ShortTZ // "Z07" stdISO8601ColonTZ // "Z07:00" // prints Z for UTC stdISO8601ColonSecondsTZ // "Z07:00:00" stdNumTZ // "-0700" // always numeric //%z stdNumSecondsTz // "-070000" stdNumShortTZ // "-07" // always numeric stdNumColonTZ // "-07:00" // always numeric stdNumColonSecondsTZ // "-07:00:00" stdFracSecond0 // ".0", ".00", ... , trailing zeros included stdFracSecond9 // ".9", ".99", ..., trailing zeros omitted
var TimeFormatRegexEscapeMap = map[string]string{
"^": "\\^",
".": "\\.",
"*": "\\*",
"?": "\\?",
"|": "\\|",
"[": "\\[",
"]": "\\]",
"(": "\\(",
")": "\\)",
"{": "\\{",
"}": "\\}",
"$": "\\$",
}
The characters required to be escaped are these characters special in regex, but normal in json. Characters are special in regex: ^ . * ? + - \ | [ ] ( ) { } $ + is already part of the timestamp format - is not required to be escaped when not inside []. \ is already required to be escaped in json too. The remaining characters are: ^ . * ? | [ ] ( ) { } $
var TimeFormatRexMap = map[string]string{
"%B": "\\w{7}",
"%b": "\\w{3}",
"%-m": "\\s{0,1}\\d{1,2}",
"%m": "\\s{0,1}\\d{1,2}",
"%A": "\\w{6,9}",
"%a": "\\w{3}",
"%-d": "\\s{0,1}\\d{1,2}",
"%d": "\\s{0,1}\\d{1,2}",
"%H": "\\d{2}",
"%-I": "\\d{1,2}",
"%I": "\\d{2}",
"%-M": "\\d{1,2}",
"%M": "\\d{2}",
"%-S": "\\d{1,2}",
"%S": "\\d{2}",
"%Y": "\\d{4}",
"%y": "\\d{2}",
"%p": "\\w{2}",
"%Z": "\\w{3}",
"%z": "[\\+-]\\d{4}",
"%f": "(\\d{1,9})",
}
Functions ¶
func GetCurPath ¶
func GetCurPath() string
func RegisterRule ¶
Types ¶
type AutoRemoval ¶
type AutoRemoval struct { }
func (*AutoRemoval) ApplyRule ¶
func (r *AutoRemoval) ApplyRule(input interface{}) (returnKey string, returnVal interface{})
type FileConfig ¶
type FileConfig struct { }
func (*FileConfig) ApplyRule ¶
func (f *FileConfig) ApplyRule(input interface{}) (returnKey string, returnVal interface{})
func (*FileConfig) Merge ¶
func (f *FileConfig) Merge(source map[string]interface{}, result map[string]interface{})
type FromBeginning ¶
type FromBeginning struct { }
func (*FromBeginning) ApplyRule ¶
func (f *FromBeginning) ApplyRule(input interface{}) (returnKey string, returnVal interface{})
type LogGroupName ¶
type LogGroupName struct { }
func (*LogGroupName) ApplyRule ¶
func (l *LogGroupName) ApplyRule(input interface{}) (returnKey string, returnVal interface{})
type LogStreamName ¶
type LogStreamName struct { }
func (*LogStreamName) ApplyRule ¶
func (l *LogStreamName) ApplyRule(input interface{}) (returnKey string, returnVal interface{})
type MultiLineStartPattern ¶
type MultiLineStartPattern struct { }
func (*MultiLineStartPattern) ApplyRule ¶
func (m *MultiLineStartPattern) ApplyRule(input interface{}) (returnKey string, returnVal interface{})
type OutputLogConfigFile ¶
type PublishMultiLogs ¶
type PublishMultiLogs struct { }
func (*PublishMultiLogs) ApplyRule ¶
func (l *PublishMultiLogs) ApplyRule(input interface{}) (returnKey string, returnVal interface{})
type RetentionInDays ¶ added in v1.247350.0
type RetentionInDays struct { }
func (*RetentionInDays) ApplyRule ¶ added in v1.247350.0
func (f *RetentionInDays) ApplyRule(input interface{}) (returnKey string, returnVal interface{})
type Rule ¶
type Rule translator.Rule
type TimestampLayout ¶
type TimestampLayout struct { }
func (*TimestampLayout) ApplyRule ¶
func (t *TimestampLayout) ApplyRule(input interface{}) (returnKey string, returnVal interface{})
ApplyRule add timestamp layout do not add timestamp check when viewing cwa logfile
type TimestampRegex ¶ added in v1.300030.0
type TimestampRegex struct { }
func (*TimestampRegex) ApplyRule ¶ added in v1.300030.0
func (t *TimestampRegex) ApplyRule(input interface{}) (returnKey string, returnVal interface{})
ApplyRule add timestamp regex do not add timestamp check when viewing cwa logfile