github.com/alibaba/ilogtail/pkg@v0.0.0-20250526110833-c53b480d046c/config/global_config.go (about) 1 // Copyright 2021 iLogtail Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package config 16 17 import ( 18 "fmt" 19 "runtime" 20 ) 21 22 // GlobalConfig represents global configurations of plugin system. 23 type GlobalConfig struct { 24 InputMaxFirstCollectDelayMs int // 10s by default, If InputMaxFirstCollectDelayMs is greater than interval, it will use interval instead. 25 InputIntervalMs int 26 AggregatIntervalMs int 27 FlushIntervalMs int 28 DefaultLogQueueSize int 29 DefaultLogGroupQueueSize int 30 // Directory to store prometheus configuration file. 31 LoongCollectorPrometheusAuthorizationPath string 32 // Directory to store loongcollector data, such as checkpoint, etc. 33 LoongCollectorConfDir string 34 // Directory to store loongcollector log config. 35 LoongCollectorLogConfDir string 36 // Directory to store loongcollector log. 37 LoongCollectorLogDir string 38 // Directory to store loongcollector data. 39 LoongCollectorDataDir string 40 // Directory to store loongcollector debug data. 41 LoongCollectorDebugDir string 42 // Directory to store loongcollector third party data. 43 LoongCollectorThirdPartyDir string 44 // Log name of loongcollector plugin. 45 LoongCollectorPluginLogName string 46 // Tag of loongcollector version. 47 LoongCollectorVersionTag string 48 // Checkpoint dir name of loongcollector plugin. 49 LoongCollectorGoCheckPointDir string 50 // Checkpoint file name of loongcollector plugin. 51 LoongCollectorGoCheckPointFile string 52 // Network identification from loongcollector. 53 HostIP string 54 Hostname string 55 DelayStopSec int 56 57 EnableTimestampNanosecond bool 58 UsingOldContentTag bool 59 EnableSlsMetricsFormat bool 60 EnableProcessorTag bool 61 62 PipelineMetaTagKey map[string]string 63 AppendingAllEnvMetaTag bool 64 AgentEnvMetaTagKey map[string]string 65 } 66 67 // LoongcollectorGlobalConfig is the singleton instance of GlobalConfig. 68 var LoongcollectorGlobalConfig = newGlobalConfig() 69 70 // StatisticsConfigJson, AlarmConfigJson 71 var BaseVersion = "0.1.0" // will be overwritten through ldflags at compile time 72 var UserAgent = fmt.Sprintf("ilogtail/%v (%v)", BaseVersion, runtime.GOOS) // set in global config 73 74 func newGlobalConfig() (cfg GlobalConfig) { 75 cfg = GlobalConfig{ 76 InputMaxFirstCollectDelayMs: 10000, // 10s 77 InputIntervalMs: 1000, // 1s 78 AggregatIntervalMs: 3000, 79 FlushIntervalMs: 3000, 80 DefaultLogQueueSize: 1000, 81 DefaultLogGroupQueueSize: 4, 82 LoongCollectorConfDir: "./conf/", 83 LoongCollectorLogConfDir: "./conf/", 84 LoongCollectorLogDir: "./log/", 85 LoongCollectorPluginLogName: "go_plugin.LOG", 86 LoongCollectorVersionTag: "loongcollector_version", 87 LoongCollectorGoCheckPointDir: "./data/", 88 LoongCollectorGoCheckPointFile: "go_plugin_checkpoint", 89 LoongCollectorDataDir: "./data/", 90 LoongCollectorDebugDir: "./debug/", 91 LoongCollectorThirdPartyDir: "./thirdparty/", 92 LoongCollectorPrometheusAuthorizationPath: "./conf/", 93 DelayStopSec: 300, 94 } 95 return 96 }