Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Send Gitea logs to Azure #14965

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

chore: Send Gitea logs to Azure #14965

wants to merge 3 commits into from

Conversation

mlqn
Copy link
Contributor

@mlqn mlqn commented Mar 13, 2025

Description

Gitea logs are saved as files in the pod, which has two drawbacks:

  • They are not available in Azure, meaning we cannot properly monitor them
  • The logs are destroyed when the pod is destroyed

To address this issue, I propose in this PR to:

  • Change Gitea log mode from file to console to ensure logs are captured in AKS logs
  • Set STDERR to true to output error logs to stderr
  • Change Gitea log level from info to error to be consistent with nginx log level and prevent flooding logs with non-critical logs like:
2025/03/13 00:00:32 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 19.5ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:33 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 23.9ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:34 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 21.2ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:35 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 23.3ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:36 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 23.6ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:37 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 21.6ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:38 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 22.0ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:39 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 22.7ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:40 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 25.0ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:41 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 20.3ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:42 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 19.7ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:43 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 21.9ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:44 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 21.7ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:45 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 19.4ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:46 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 21.4ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:47 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 22.9ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:48 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 21.8ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:49 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 23.8ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:50 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 25.9ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:51 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 21.2ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:52 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 21.8ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:53 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 20.2ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:54 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 20.0ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:55 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 21.4ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:56 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 20.7ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:57 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 20.6ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:58 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 28.8ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:00:59 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 26.9ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:00 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 25.9ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:01 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 19.6ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:02 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 24.5ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:03 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 20.9ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:04 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 21.1ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:05 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 20.0ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:06 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 23.0ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:07 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 24.9ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:08 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 21.5ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:09 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 25.8ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:10 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 19.8ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:11 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 28.3ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:12 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 19.2ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:13 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 20.2ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:14 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.0.116:41398, 200 OK in 24.4ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)
2025/03/13 00:01:15 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for 10.48.1.5:42652, 200 OK in 24.6ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)

Related Issue(s)

  • PR itself

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)

Summary by CodeRabbit

  • Chores
    • Improved logging output by directing logs to the console, with messages now focused solely on errors.
    • Updated log routing to use standard error, ensuring cleaner and more relevant monitoring.

@github-actions github-actions bot added the solution/studio/repos Issues related to the Altinn Studio Repos solution (Gitea). label Mar 13, 2025
Copy link
Contributor

coderabbitai bot commented Mar 13, 2025

📝 Walkthrough

Walkthrough

This update modifies the logging configuration in the application's configuration file. The changes remove the ROOT_PATH setting under the [log] section, update the MODE from file to console, and change the LEVEL from Info to Error. Additionally, a new [log.console] section is introduced with the STDERR entry set to true.

Changes

File(s) Change Summary
gitea/.../app.ini Removed ROOT_PATH from [log]; updated MODE from file to console; updated LEVEL from Info to Error; added STDERR with value true in the new [log.console] section.

Suggested labels

ops/ci-cd, backend, skip-manual-testing, skip-documentation

Suggested reviewers

  • github-actions
  • ErlingHauan

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b486c5f and 3577a00.

📒 Files selected for processing (1)
  • gitea/files/conf/app.ini (1 hunks)
🔇 Additional comments (2)
gitea/files/conf/app.ini (2)

46-47: Updated Logging Settings Reflect PR Objectives
The configuration now sets MODE to console and LEVEL to Error, aligning with the PR objectives to send logs to Azure by outputting them to the console and filtering out non-critical logs. Additionally, ensuring that any file-based logging configuration such as ROOT_PATH is removed helps avoid conflicts with the new logging approach.


49-50: Direct Console Logging to STDERR
The introduction of the [log.console] section with STDERR = true guarantees that error logs are directed to the standard error stream. This is ideal for cloud environments like Azure AKS, where capturing error logs through STDERR can be integrated into centralized logging systems.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution/studio/repos Issues related to the Altinn Studio Repos solution (Gitea). team/studio-core
Projects
Status: 🧪 Test
Development

Successfully merging this pull request may close these issues.

2 participants