Skip to content

Commit 2c4b416

Browse files
committed
Merge branch 'main' of github.com:Takuka0311/ilogtail
Change-Id: Ia87ad7c6667c92a37504dc2322e9f4a3a2dab420 Co-developed-by: Cursor <noreply@cursor.com>
2 parents 71f8431 + 93a60a1 commit 2c4b416

178 files changed

Lines changed: 9281 additions & 1878 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/loongcollector-community-edition/loongcollector-build-linux:2.1.9
15+
FROM sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/loongcollector-community-edition/loongcollector-build-linux:2.1.10
1616

1717
ARG USERNAME=admin
1818
ARG USER_PASSWORD

.devcontainer/Dockerfile.lldb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/loongcollector-community-edition/loongcollector-build-linux:2.1.9
15+
FROM sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/loongcollector-community-edition/loongcollector-build-linux:2.1.10
1616

1717
ARG USERNAME=admin
1818
ARG USER_PASSWORD
Lines changed: 116 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: Benchmark
15+
name: Build Edge Image
1616

1717
on:
1818
push:
@@ -27,25 +27,28 @@ on:
2727
- 'CHANGELOG.md'
2828

2929
jobs:
30-
Build-LoongCollector-Linux:
30+
# 第一步:构建不同架构的安装包
31+
build-linux:
3132
runs-on: ${{ matrix.runner }}
33+
timeout-minutes: 60
3234
strategy:
3335
matrix:
3436
include:
3537
- arch: amd64
36-
runner: [self-hosted, Linux, X64]
38+
runner: ubuntu-latest
3739
- arch: arm64
38-
runner: [self-hosted, Linux, ARM64]
39-
fail-fast: false
40-
permissions:
41-
contents: write
42-
packages: write
40+
runner: ubuntu-24.04-arm
4341
steps:
4442
- name: Check out code
4543
uses: actions/checkout@v4
4644
with:
4745
submodules: false
48-
46+
47+
- name: Set up Go
48+
uses: actions/setup-go@v4
49+
with:
50+
go-version: 1.19.10
51+
4952
- name: Set custom submodule URL and fetch
5053
run: |
5154
SUBMODULE_PATH="core/_thirdparty/coolbpf"
@@ -54,26 +57,115 @@ jobs:
5457
cd $SUBMODULE_PATH
5558
echo "Current commit: $(git rev-parse HEAD)"
5659
57-
- name: Build linux/${{ matrix.arch }} image
60+
- name: Build Linux ${{ matrix.arch }} package
61+
env:
62+
VERSION: edge
5863
run: |
59-
REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
60-
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $REPO_OWNER --password-stdin
61-
docker build --tag ghcr.io/$REPO_OWNER/loongcollector:edge-linux-${{ matrix.arch }} \
62-
--file ./docker/Dockerfile_edge_linux .
63-
docker push ghcr.io/$REPO_OWNER/loongcollector:edge-linux-${{ matrix.arch }}
64+
make dist
65+
ls -la dist/
6466
65-
Build-LoongCollector-Image:
67+
- name: Upload Linux ${{ matrix.arch }} artifacts
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: loongcollector-edge.linux-${{ matrix.arch }}.tar.gz
71+
path: dist/loongcollector-edge.linux-${{ matrix.arch }}.tar.gz
72+
retention-days: 1
73+
74+
# 第二步:构建和上传 Docker 镜像
75+
upload-images:
76+
needs: build-linux
6677
runs-on: ubuntu-latest
67-
needs: [ Build-LoongCollector-Linux ]
78+
timeout-minutes: 60
79+
permissions:
80+
contents: write
81+
packages: write
6882
steps:
69-
- name: Create and push manifest
83+
- name: Check out code
84+
uses: actions/checkout@v4
85+
with:
86+
submodules: false
87+
88+
- name: Set up Docker Buildx
89+
uses: docker/setup-buildx-action@v3
90+
91+
- name: Login to GitHub Container Registry
92+
uses: docker/login-action@v3
93+
with:
94+
registry: ghcr.io
95+
username: ${{ github.repository_owner }}
96+
password: ${{ secrets.GITHUB_TOKEN }}
97+
98+
- name: Download Linux AMD64 artifacts
99+
uses: actions/download-artifact@v4
100+
with:
101+
name: loongcollector-edge.linux-amd64.tar.gz
102+
path: dist/
103+
104+
- name: Download Linux ARM64 artifacts
105+
uses: actions/download-artifact@v4
106+
with:
107+
name: loongcollector-edge.linux-arm64.tar.gz
108+
path: dist/
109+
110+
- name: List artifacts for Docker build
70111
run: |
112+
echo "Artifacts available for Docker build:"
113+
ls -la dist/ || echo "No artifacts found"
114+
115+
- name: Build and push Docker images
116+
run: |
117+
VERSION="edge"
71118
REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
72-
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $REPO_OWNER --password-stdin
73-
docker manifest create ghcr.io/$REPO_OWNER/loongcollector:edge \
74-
--amend ghcr.io/$REPO_OWNER/loongcollector:edge-linux-amd64 \
75-
--amend ghcr.io/$REPO_OWNER/loongcollector:edge-linux-arm64
76-
docker manifest push ghcr.io/$REPO_OWNER/loongcollector:edge
119+
120+
# 获取当前时间戳
121+
TIMESTAMP=$(date +"%Y%m%d%H%M%S")
122+
TIMESTAMPED_TAG="edge-$TIMESTAMP"
123+
124+
echo "Building and pushing Docker images for version $VERSION and $TIMESTAMPED_TAG"
125+
126+
# 检查是否有Linux构建产物
127+
LINUX_AMD64_FILE="dist/loongcollector-$VERSION.linux-amd64.tar.gz"
128+
LINUX_ARM64_FILE="dist/loongcollector-$VERSION.linux-arm64.tar.gz"
129+
130+
if [ ! -f "$LINUX_AMD64_FILE" ] && [ ! -f "$LINUX_ARM64_FILE" ]; then
131+
echo "Error: No Linux packages found for Docker build"
132+
echo "Available files in dist/:"
133+
ls -la dist/ || echo "dist/ directory is empty"
134+
echo "Expected files:"
135+
echo "- $LINUX_AMD64_FILE"
136+
echo "- $LINUX_ARM64_FILE"
137+
exit 1
138+
fi
139+
140+
# 确定要构建的平台
141+
PLATFORMS=""
142+
if [ -f "$LINUX_AMD64_FILE" ]; then
143+
PLATFORMS="$PLATFORMS,linux/amd64"
144+
echo "Found Linux AMD64 package: $LINUX_AMD64_FILE"
145+
fi
146+
if [ -f "$LINUX_ARM64_FILE" ]; then
147+
PLATFORMS="$PLATFORMS,linux/arm64"
148+
echo "Found Linux ARM64 package: $LINUX_ARM64_FILE"
149+
fi
150+
151+
# 移除开头的逗号
152+
PLATFORMS=$(echo $PLATFORMS | sed 's/^,//')
153+
154+
echo "Building Docker images for platforms: $PLATFORMS"
155+
156+
# 构建并推送多架构镜像,同时打两个标签
157+
docker buildx build --platform "$PLATFORMS" \
158+
--file docker/Dockerfile_release \
159+
--build-arg VERSION=$VERSION \
160+
--build-arg HOST_OS=Linux \
161+
--tag ghcr.io/$REPO_OWNER/loongcollector:$VERSION \
162+
--tag ghcr.io/$REPO_OWNER/loongcollector:$TIMESTAMPED_TAG \
163+
--push .
164+
165+
echo "Docker images pushed successfully:"
166+
echo "- ghcr.io/$REPO_OWNER/loongcollector:$VERSION"
167+
echo "- ghcr.io/$REPO_OWNER/loongcollector:$TIMESTAMPED_TAG"
168+
77169
78170
# Benchmark:
79171
# runs-on: ${{ matrix.runner }}
@@ -192,7 +284,7 @@ jobs:
192284
# run: git push 'https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository_owner }}/LoongCollector.git' gh-pages:gh-pages
193285

194286
actions-timeline:
195-
needs: [Build-LoongCollector-Image]
287+
needs: [upload-images]
196288
runs-on: ubuntu-latest
197289
permissions:
198290
actions: read

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424

2525
LoongCollector is a high-performance, lightweight observability data collector designed for modern cloud-native environments. Born from Alibaba's 15-year journey handling exponential traffic growth and powering tens of millions of deployments, LoongCollector delivers **10x higher throughput** with **80% lower resource usage** compared to open-source alternatives.
2626

27+
LoongCollector is a key component of LoongSuite(Alibaba's unified observability data collection suite). LoongSuite includes the following key components:
28+
29+
* [LoongCollector](https://github.com/alibaba/loongcollector): universal node agent, which prodivdes log collection, prometheus metric collection, and network and security collection capabilities based on eBPF.
30+
* [LoongSuite Python Agent](https://github.com/alibaba/loongsuite-python-agent): a process agent providing instrumentaion for python applications.
31+
* [LoongSuite Go Agent](https://github.com/alibaba/loongsuite-go-agent): a process agent for golang with compile time instrumentation.
32+
* [LoongSuite Java Agent](https://github.com/alibaba/loongsuite-java-agent): a process agent for Java applications.
33+
* Other upcoming language agent.
34+
2735
### 🚀 Core Advantages
2836

2937
- **⚡ High Performance**
@@ -173,9 +181,17 @@ We welcome contributions from the community! Here are some ways you can help:
173181
- **WeChat/DingTalk**: LoongCollector社区
174182

175183
<div align="center">
176-
<img src="https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/images/chatgroup/chatgroup.png" alt="Community QR Code" width="300"/>
184+
<img src="https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/images/chatgroup/chatgroup.png" alt="Community QR Code" width="60%"/>
177185
</div>
178186

187+
### Other LoongSuite components's Community contact information
188+
189+
We are looking forward to your feedback and suggestions. You can scan the QR code below to engage with us.
190+
191+
| LoongSuite Python SIG | LoongSuite Go SIG | LoongSuite Java SIG |
192+
|----|----|----|
193+
| <img src="https://github.com/alibaba/loongsuite-python-agent/blob/main/docs/_assets/img/loongsuite-python-sig-dingtalk.jpg" height="150"> | <img src="https://github.com/alibaba/loongsuite-python-agent/blob/main/docs/_assets/img/loongsuite-go-sig-dingtalk.png" height="150"> | <img src="https://github.com/alibaba/loongsuite-python-agent/blob/main/docs/_assets/img/loongsuite-java-sig-dingtalk.jpg" height="150"> |
194+
179195
## 📄 License
180196

181197
LoongCollector is licensed under the [Apache 2.0 License](./LICENSE).

core/CMakeLists.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ cmake_dependent_option(ENABLE_CORP_FEATURE "Enable corp feature" OFF "ENABLE_ENT
3434
option(WITHOUTGDB "Build Logtail without gdb")
3535
option(WITHSPL "Build Logtail and UT with SPL" ON)
3636
option(BUILD_LOGTAIL_UT "Build unit test for Logtail")
37+
option(BUILD_LOGTAIL_UT_WITH_BENCHMARK "Build unit test for benchmark" OFF)
3738
cmake_dependent_option(ENABLE_ADDRESS_SANITIZER "Enable address sanitizer" ON "CMAKE_BUILD_TYPE STREQUAL Debug;NOT ANDROID" OFF)
3839
set(PROVIDER_PATH ${CMAKE_CURRENT_SOURCE_DIR}/provider CACHE PATH "Path to the provider module") # external provider path can be set with -DPROVIDER_PATH
3940
set(UNITTEST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/unittest CACHE PATH "Path to the unittest module") # external unittest path can be set with -DUNITTEST_PATH
@@ -60,8 +61,12 @@ endif ()
6061

6162
if (NOT WITHSPL)
6263
add_definitions(-D__EXCLUDE_SPL__)
64+
else ()
65+
add_definitions(-D__INCLUDE_SSE4_2__)
6366
endif()
6467

68+
message(STATUS "loongcollector Cpp compile flags: ${CMAKE_CXX_FLAGS}")
69+
6570
add_definitions(-DXXH_DISPATCH_AVX2=0)
6671
add_definitions(-DXXH_DISPATCH_AVX512=0)
6772

@@ -84,9 +89,11 @@ if (UNIX)
8489
string(REPLACE "-O3" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
8590
string(REPLACE "-O3" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
8691
if (BUILD_LOGTAIL_UT)
87-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
88-
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
89-
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
92+
if (NOT BUILD_LOGTAIL_UT_WITH_BENCHMARK)
93+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
94+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
95+
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
96+
endif ()
9097
endif ()
9198
elseif (MSVC)
9299
add_definitions(-DNOMINMAX)
@@ -151,7 +158,7 @@ if (LINUX)
151158
endif()
152159
set(SUB_DIRECTORIES_LIST ${SUB_DIRECTORIES_LIST} ebpf ebpf/type ebpf/type/table ebpf/util ebpf/util/sampler ebpf/protocol/http ebpf/protocol ebpf/plugin/file_security ebpf/plugin/network_observer ebpf/plugin/process_security ebpf/plugin/network_security ebpf/plugin ebpf/observer ebpf/security
153160
prometheus prometheus/labels prometheus/schedulers prometheus/async prometheus/component
154-
host_monitor host_monitor/collector forward forward/loongsuite
161+
host_monitor host_monitor/collector host_monitor/common forward forward/loongsuite
155162
)
156163
elseif(MSVC)
157164
endif ()

core/_thirdparty/coolbpf

Submodule coolbpf updated from c650063 to 96b7356

core/app_config/AppConfig.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,7 @@ void AppConfig::ReadFlagsFromMap(const std::unordered_map<std::string, std::stri
15091509
* - 记录无法转换的值
15101510
*/
15111511
void AppConfig::RecurseParseJsonToFlags(const Json::Value& confJson, std::string prefix) {
1512-
const static unordered_set<string> sIgnoreKeySet = {"data_server_list", "data_servers"};
1512+
const static unordered_set<string> sIgnoreKeySet = {"data_server_list", "data_servers", "auth_config"};
15131513
const static unordered_set<string> sForceKeySet = {"config_server_address_list", "config_servers"};
15141514
for (auto name : confJson.getMemberNames()) {
15151515
auto jsonvalue = confJson[name];

core/application/Application.cpp

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,17 +216,29 @@ void Application::Start() { // GCOVR_EXCL_START
216216

217217
// config provider
218218
{
219-
// add local config dir
220-
filesystem::path localConfigPath = filesystem::path(AppConfig::GetInstance()->GetLoongcollectorConfDir())
221-
/ GetContinuousPipelineConfigDir() / "local";
222-
error_code ec;
223-
filesystem::create_directories(localConfigPath, ec);
224-
if (ec) {
219+
// add local continuous config dir
220+
filesystem::path localContinuousConfigPath
221+
= filesystem::path(AppConfig::GetInstance()->GetLoongcollectorConfDir()) / GetContinuousPipelineConfigDir()
222+
/ "local";
223+
error_code ec1;
224+
filesystem::create_directories(localContinuousConfigPath, ec1);
225+
if (ec1) {
225226
LOG_WARNING(sLogger,
226227
("failed to create dir for local continuous_pipeline_config",
227-
"manual creation may be required")("error code", ec.value())("error msg", ec.message()));
228+
"manual creation may be required")("error code", ec1.value())("error msg", ec1.message()));
228229
}
229-
PipelineConfigWatcher::GetInstance()->AddSource(localConfigPath.string());
230+
PipelineConfigWatcher::GetInstance()->AddSource(localContinuousConfigPath.string());
231+
// add local onetime config dir
232+
filesystem::path localOnetimeConfigPath = filesystem::path(AppConfig::GetInstance()->GetLoongcollectorConfDir())
233+
/ "onetime_pipeline_config" / "local";
234+
error_code ec2;
235+
filesystem::create_directories(localOnetimeConfigPath, ec2);
236+
if (ec2) {
237+
LOG_WARNING(sLogger,
238+
("failed to create dir for local onetime_pipeline_config",
239+
"manual creation may be required")("error code", ec2.value())("error msg", ec2.message()));
240+
}
241+
PipelineConfigWatcher::GetInstance()->AddSource(localOnetimeConfigPath.string());
230242
}
231243
#ifdef __ENTERPRISE__
232244
EnterpriseConfigProvider::GetInstance()->Start();

core/collection_pipeline/CollectionPipeline.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ bool CollectionPipeline::Init(CollectionConfig&& config) {
9090
// for special treatment below
9191
const InputFile* inputFile = nullptr;
9292
const InputContainerStdio* inputContainerStdio = nullptr;
93+
const InputStaticFile* inputStaticFile = nullptr;
9394
bool hasFlusherSLS = false;
9495

9596
// to send alarm and init MetricsRecord before flusherSLS is built, a temporary object is made, which will be
@@ -122,6 +123,8 @@ bool CollectionPipeline::Init(CollectionConfig&& config) {
122123
inputFile = static_cast<const InputFile*>(mInputs[0]->GetPlugin());
123124
} else if (pluginType == InputContainerStdio::sName) {
124125
inputContainerStdio = static_cast<const InputContainerStdio*>(mInputs[0]->GetPlugin());
126+
} else if (pluginType == InputStaticFile::sName) {
127+
inputStaticFile = static_cast<const InputStaticFile*>(mInputs[0]->GetPlugin());
125128
}
126129
} else {
127130
AddPluginToGoPipeline(pluginType, detail, "inputs", mGoPipelineWithInput);
@@ -251,7 +254,8 @@ bool CollectionPipeline::Init(CollectionConfig&& config) {
251254
}
252255

253256
// mandatory override global.DefaultLogQueueSize in Go pipeline when input_file and Go processing coexist.
254-
if ((inputFile != nullptr || inputContainerStdio != nullptr) && IsFlushingThroughGoPipeline()) {
257+
if ((inputFile != nullptr || inputContainerStdio != nullptr || inputStaticFile != nullptr)
258+
&& IsFlushingThroughGoPipeline()) {
255259
mGoPipelineWithoutInput["global"]["DefaultLogQueueSize"]
256260
= Json::Value(INT32_FLAG(default_plugin_log_queue_size));
257261
}

core/collection_pipeline/CollectionPipeline.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "monitor/MetricManager.h"
3535
#include "plugin/input/InputContainerStdio.h"
3636
#include "plugin/input/InputFile.h"
37+
#include "plugin/input/InputStaticFile.h"
3738

3839
namespace logtail {
3940

0 commit comments

Comments
 (0)