Skip to content

Commit

Permalink
Merge branch 'master' into deployment-markers-dec31
Browse files Browse the repository at this point in the history
  • Loading branch information
Simplychee authored Jan 7, 2025
2 parents afce095 + 3f0fe3a commit b180f4e
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 118 deletions.
225 changes: 112 additions & 113 deletions docs/shipping/Code/go.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,118 @@ if err != nil {
l.Stop() // Drains the log buffer
```

</TabItem>
<TabItem value="OpenTelemetry" label="OpenTelemetry">

This integration uses the OpenTelemetry logging exporter to send logs to Logz.io via the OpenTelemetry Protocol (OTLP) listener.

### Prerequisites

- Go 1.21 or newer

:::note
If you need an example aplication to test this integration, please refer to our [Go OpenTelemetry repository](https://github.com/logzio/opentelemetry-examples/tree/main/go/logs).
:::

### Configure the instrumentation


1. Install OpenTelemetry dependencies:

```bash
go get go.opentelemetry.io/otel
go get go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp
go get go.opentelemetry.io/otel/exporters/stdout/stdoutlog
```

2. Create a new file named `otel.go` and add the following code to set up OpenTelemetry logging:


```go
package main

import (
"context"
"fmt"
"log"

"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp"
"go.opentelemetry.io/otel/exporters/stdout/stdoutlog"
"go.opentelemetry.io/otel/log/global"
sdklog "go.opentelemetry.io/otel/sdk/log"
)

func newLoggerProvider() (*sdklog.LoggerProvider, error) {
// Create stdout log exporter
stdoutExporter, err := stdoutlog.New(stdoutlog.WithPrettyPrint())
if err != nil {
return nil, fmt.Errorf("failed to create stdout exporter: %w", err)
}

// Create OTLP HTTP log exporter for Logz.io
httpExporter, err := otlploghttp.New(context.Background(),
otlploghttp.WithEndpoint("otlp-listener.logz.io"),
otlploghttp.WithHeaders(map[string]string{
"Authorization": "Bearer <LOG-SHIPPING-TOKEN>",
"user-agent": "logzio-go-logs-otlp",
}),
otlploghttp.WithURLPath("/v1/logs"),
)
if err != nil {
return nil, fmt.Errorf("failed to create OTLP HTTP exporter: %w", err)
}

// Create a logger provider with both exporters
loggerProvider := sdklog.NewLoggerProvider(
sdklog.WithProcessor(sdklog.NewBatchProcessor(stdoutExporter)), // For stdout
sdklog.WithProcessor(sdklog.NewBatchProcessor(httpExporter)), // For HTTP export
)

return loggerProvider, nil
}

// setupOTelSDK bootstraps the OpenTelemetry logging pipeline.
func setupOTelSDK(ctx context.Context) (shutdown func(context.Context) error, err error) {
// Set up logger provider.
loggerProvider, err := newLoggerProvider()
if err != nil {
return nil, err
}

// Set the global logger provider
global.SetLoggerProvider(loggerProvider)

// Return a shutdown function
shutdown = func(ctx context.Context) error {
err := loggerProvider.Shutdown(ctx)
if err != nil {
log.Printf("Error during logger provider shutdown: %v", err)
}
return err
}

return shutdown, nil
}

```


{@include: ../../_include/log-shipping/log-shipping-token.md}
Update the `listener.logz.io` part in `https://otlp-listener.logz.io/v1/logs` with the URL for [your hosting region](https://docs.logz.io/docs/user-guide/admin/hosting-regions/account-region).


3. Run your application.

### Check Logz.io for your logs


Allow some time for data ingestion, then open [Open Search Dashboards](https://app.logz.io/#/dashboard/osd).

Encounter an issue? See our [log shipping troubleshooting](https://docs.logz.io/docs/user-guide/log-management/troubleshooting/log-shipping-troubleshooting/) guide.


</TabItem>
</Tabs>

## Metrics

Expand Down Expand Up @@ -379,119 +491,6 @@ Install the pre-built dashboard to enhance the observability of your metrics.

{@include: ../../_include/metric-shipping/generic-dashboard.html}

</TabItem>
<TabItem value="OpenTelemetry" label="OpenTelemetry">

This integration uses the OpenTelemetry logging exporter to send logs to Logz.io via the OpenTelemetry Protocol (OTLP) listener.

### Prerequisites

- Go 1.21 or newer

:::note
If you need an example aplication to test this integration, please refer to our [Go OpenTelemetry repository](https://github.com/logzio/opentelemetry-examples/tree/main/go/logs).
:::

### Configure the instrumentation


1. Install OpenTelemetry dependencies:

```bash
go get go.opentelemetry.io/otel
go get go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp
go get go.opentelemetry.io/otel/exporters/stdout/stdoutlog
```

2. Create a new file named `otel.go` and add the following code to set up OpenTelemetry logging:


```go
package main

import (
"context"
"fmt"
"log"

"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp"
"go.opentelemetry.io/otel/exporters/stdout/stdoutlog"
"go.opentelemetry.io/otel/log/global"
sdklog "go.opentelemetry.io/otel/sdk/log"
)

func newLoggerProvider() (*sdklog.LoggerProvider, error) {
// Create stdout log exporter
stdoutExporter, err := stdoutlog.New(stdoutlog.WithPrettyPrint())
if err != nil {
return nil, fmt.Errorf("failed to create stdout exporter: %w", err)
}

// Create OTLP HTTP log exporter for Logz.io
httpExporter, err := otlploghttp.New(context.Background(),
otlploghttp.WithEndpoint("otlp-listener.logz.io"),
otlploghttp.WithHeaders(map[string]string{
"Authorization": "Bearer <LOG-SHIPPING-TOKEN>",
"user-agent": "logzio-go-logs-otlp",
}),
otlploghttp.WithURLPath("/v1/logs"),
)
if err != nil {
return nil, fmt.Errorf("failed to create OTLP HTTP exporter: %w", err)
}

// Create a logger provider with both exporters
loggerProvider := sdklog.NewLoggerProvider(
sdklog.WithProcessor(sdklog.NewBatchProcessor(stdoutExporter)), // For stdout
sdklog.WithProcessor(sdklog.NewBatchProcessor(httpExporter)), // For HTTP export
)

return loggerProvider, nil
}

// setupOTelSDK bootstraps the OpenTelemetry logging pipeline.
func setupOTelSDK(ctx context.Context) (shutdown func(context.Context) error, err error) {
// Set up logger provider.
loggerProvider, err := newLoggerProvider()
if err != nil {
return nil, err
}

// Set the global logger provider
global.SetLoggerProvider(loggerProvider)

// Return a shutdown function
shutdown = func(ctx context.Context) error {
err := loggerProvider.Shutdown(ctx)
if err != nil {
log.Printf("Error during logger provider shutdown: %v", err)
}
return err
}

return shutdown, nil
}

```


{@include: ../../_include/log-shipping/log-shipping-token.md}
Update the `listener.logz.io` part in `https://otlp-listener.logz.io/v1/logs` with the URL for [your hosting region](https://docs.logz.io/docs/user-guide/admin/hosting-regions/account-region).


3. Run your application.

### Check Logz.io for your logs


Allow some time for data ingestion, then open [Open Search Dashboards](https://app.logz.io/#/dashboard/osd).

Encounter an issue? See our [log shipping troubleshooting](https://docs.logz.io/docs/user-guide/log-management/troubleshooting/log-shipping-troubleshooting/) guide.


</TabItem>
</Tabs>


## Traces

Expand Down
6 changes: 3 additions & 3 deletions docs/shipping/Code/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -1451,10 +1451,10 @@ The OpenTelemetry Collector receives traces from the application and exports the
#### Build Docker Images
Build Docker images for both the Node.js application and the OpenTelemetry Collector:
Build Docker images for both the Python application and the OpenTelemetry Collector:
```shell
# Build Node.js application image
# Build Python application image
cd python-app/
docker build --platform linux/amd64 -t your-python-app:latest .
Expand Down Expand Up @@ -1490,7 +1490,7 @@ aws logs create-log-group --log-group-name /ecs/otel-collector
#### Define ECS Task
Create a task definition (task-definition.json) for ECS that defines both the Node.js application container and the OpenTelemetry Collector container.
Create a task definition (task-definition.json) for ECS that defines both the Python application container and the OpenTelemetry Collector container.
#### task-definition.json
Expand Down
34 changes: 32 additions & 2 deletions docs/user-guide/observability/assistantiq.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You can now leverage the insights from your dialog and enhance data analysis to

![AI Agent screen](https://dytvr9ot2sszz.cloudfront.net/logz-docs/explore-dashboard/ai-agent-dec3.png)

<h2 id="start"> Using AI Agent </h2>
## Using AI Agent

AI Agent is available in **[Explore](https://app.logz.io/#/dashboard/explore)**, **[Kubernetes 360](https://app.logz.io/#/dashboard/observability/k8s360)**, and **[App 360](https://app.logz.io/#/dashboard/spm/services/table)**. Click the AI Agent button at the top to open the interface.

Expand All @@ -37,6 +37,36 @@ Some data sources may not be available in all observability tools (Explore, App

Once you provide input to the agent, the **dashboard's data** will be shared with Claude3.

![AI Agent screen](https://dytvr9ot2sszz.cloudfront.net/logz-docs/explore-dashboard/ai-agent-response-dec3.png)
<img src="https://dytvr9ot2sszz.cloudfront.net/logz-docs/explore-dashboard/ai-agent-main-dec23.png" alt="ai-agent-answer" width="700"/>

## AI Agent Root Cause Analyzer

Logz.io's Root Cause Analyzer (RCA) leverages GenAI to diagnose the root causes of exceptions within applications. By analyzing context and data, RCA delivers deep insights and actionable recommendations, streamlining the troubleshooting process and accelerating root cause analysis.

RCA adapts dynamically to the specific context of each problem, functioning like a knowledgeable team member who understands the nuances of the issue and provides accurate and effective analysis.

It comprehends the situation, identifies the necessary information for thorough analysis, and proactively seeks the data required.

<img src="https://dytvr9ot2sszz.cloudfront.net/logz-docs/rca/root-cause-analyzer-start.png" alt="rca-popup" width="700"/>


### How to use RCA

:::info note
RCA is currently available to Logz.io users in the **US region** using **[Explore](https://docs.logz.io/docs/user-guide/new-explore/)**.
:::


To activate RCA, navigate to [Explore > Exceptions](https://app.logz.io/#/dashboard/explore). Select the exception you want to analyze, then hover over it and click **AI Analyzer** to activate the RCA process.

<img src="https://dytvr9ot2sszz.cloudfront.net/logz-docs/rca/ai-analyzer-rca.png" alt="rca-button" width="700"/>

Once activated, RCA begins a multi-step process, gathering relevant information, analyzing it, and taking further actions to identify the root cause of the issue. You can click on each step to view a detailed explanation of what RCA is doing to move closer to finding the root cause.

Please note that the analysis may take a few minutes. Once completed, RCA will display its **Root Cause Analysis**, outlining possible causes for the issue and providing recommendations to address it or prevent it from recurring.

<img src="https://dytvr9ot2sszz.cloudfront.net/logz-docs/rca/root-cause-analysis-rca-end.png" alt="rca-end" width="700"/>



For further assistance with the AI Agent, read the [FAQ](https://docs.logz.io/docs/user-guide/observability/faq) or [contact Logz.io's Support Team](mailto:[email protected]).
4 changes: 4 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ const config = {
label: 'Videos',
href: 'https://logz.io/learn/video/',
},
{
label: 'Support Help Center',
href: 'https://logzio-support.atlassian.net/servicedesk/customer/portals',
},
{
label: 'Notices for 3rd Party Software included with the Logz.io Platform',
to: 'https://dytvr9ot2sszz.cloudfront.net/logz-docs/legal/3rd-party-software-included-with-the-logz.io-platform-sep-2022.pdf',
Expand Down

0 comments on commit b180f4e

Please sign in to comment.