Splunk Observability Cloud

PHP zero-code instrumentation not working.

luizpolli
Loves-to-Learn

Hi everyone,

I performed all the steps to instrument a php application into Splunk O11y Saas and there is not data(spans).

Following the steps done below:
1. Installed the linux packages.

 

luizpolli@PCWIN11-LPOLLI:~$ dpkg -l|egrep make
ii  automake                         1:1.16.5-1.3                                 all          Tool for generating GNU Standards-compliant Makefiles
ii  make                             4.3-4.1build1                                amd64        utility for directing compilation
ii  xxd                              2:8.2.3995-1ubuntu2.21                       amd64        tool to make (or reverse) a hex dump

luizpolli@PCWIN11-LPOLLI:~$ dpkg -l|egrep autoconf
ii  autoconf                         2.71-2                                       all          automatic configure script builder

luizpolli@PCWIN11-LPOLLI:~$ dpkg -l|grep gcc
ii  gcc                              4:11.2.0-1ubuntu1                            amd64        GNU C compiler
ii  gcc-11                           11.4.0-1ubuntu1~22.04                        amd64        GNU C compiler
ii  gcc-11-base:amd64                11.4.0-1ubuntu1~22.04                        amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-12-base:amd64                12.3.0-1ubuntu1~22.04                        amd64        GCC, the GNU Compiler Collection (base package)
ii  libgcc-11-dev:amd64              11.4.0-1ubuntu1~22.04                        amd64        GCC support library (development files)
ii  libgcc-s1:amd64                  12.3.0-1ubuntu1~22.04                        amd64        GCC support library
luizpolli@PCWIN11-LPOLLI:~$

 

 

 

2. Installed php extension using pecl and added the opentelemetry.so inside php.ini file.

luizpolli_0-1733944322533.png

 

3. Installed some extensions using composer.

 

 

php composer.phar install open-telemetry/exporter-otlp:^1.0.3
php composer.phar install php-http/guzzle7-adapter:^1.0
luizpolli@PCWIN11-LPOLLI:~$ composer show
brick/math                       0.12.1 Arbitrary-precision arithmetic library
composer/semver                  3.4.3  Semver library that offers utilities, version constraint parsing and validation.
google/protobuf                  4.29.1 proto library for PHP
guzzlehttp/guzzle                7.9.2  Guzzle is a PHP HTTP client library
guzzlehttp/promises              2.0.4  Guzzle promises library
guzzlehttp/psr7                  2.7.0  PSR-7 message implementation that also provides common utility methods
nyholm/psr7                      1.8.2  A fast PHP7 implementation of PSR-7
nyholm/psr7-server               1.1.0  Helper classes to handle PSR-7 server requests
open-telemetry/api               1.1.1  API for OpenTelemetry PHP.
open-telemetry/context           1.1.0  Context implementation for OpenTelemetry PHP.
open-telemetry/exporter-otlp     1.1.0  OTLP exporter for OpenTelemetry.
open-telemetry/gen-otlp-protobuf 1.2.1  PHP protobuf files for communication with OpenTelemetry OTLP collectors/servers.
open-telemetry/sdk               1.1.2  SDK for OpenTelemetry PHP.
open-telemetry/sem-conv          1.27.1 Semantic conventions for OpenTelemetry PHP.
php-http/discovery               1.20.0 Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations
php-http/guzzle7-adapter         1.1.0  Guzzle 7 HTTP Adapter
php-http/httplug                 2.4.1  HTTPlug, the HTTP client abstraction for PHP
php-http/promise                 1.3.1  Promise used for asynchronous HTTP requests
psr/container                    2.0.2  Common Container Interface (PHP FIG PSR-11)
psr/http-client                  1.0.3  Common interface for HTTP clients
psr/http-factory                 1.1.0  PSR-17: Common interfaces for PSR-7 HTTP message factories
psr/http-message                 2.0    Common interface for HTTP messages
psr/log                          3.0.2  Common interface for logging libraries
ralouphie/getallheaders          3.0.3  A polyfill for getallheaders.
ramsey/collection                2.0.0  A PHP library for representing and manipulating collections.
ramsey/uuid                      4.7.6  A PHP library for generating and working with universally unique identifiers (UUIDs).
symfony/deprecation-contracts    3.5.1  A generic function and convention to trigger deprecation notices
symfony/http-client              6.4.16 Provides powerful methods to fetch HTTP resources synchronously or asynchronously
symfony/http-client-contracts    3.5.1  Generic abstractions related to HTTP clients
symfony/polyfill-mbstring        1.31.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php82           1.31.0 Symfony polyfill backporting some PHP 8.2+ features to lower PHP versions
symfony/service-contracts        3.5.1  Generic abstractions related to writing services
tbachert/spi                     1.0.2  Service provider loading facility
luizpolli@PCWIN11-LPOLLI:~$

 

 

 

4. Set linux env variables and php.ini.

 

 

luizpolli@PCWIN11-LPOLLI:~$ env|grep OTEL
OTEL_EXPORTER_OTLP_TRACES_HEADERS=x-sf-token=uv8z-g77txiCZigBV1OZVg
OTEL_RESOURCE_ATTRIBUTES=deployment.environment=prod,service.version=1.0
OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.eu1.signalfx.com/trace/otlp
OTEL_SERVICE_NAME=shopping
OTEL_PHP_AUTOLOAD_ENABLED=true

luizpolli@PCWIN11-LPOLLI:~$ cat /etc/php/8.1/apache2/php.ini |grep OTEL
OTEL_RESOURCE_ATTRIBUTES="deployment.environment=prod,service.version=1.0"
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318"
OTEL_SERVICE_NAME=shopping
OTEL_PHP_AUTOLOAD_ENABLED=true
luizpolli@PCWIN11-LPOLLI:~$

 

 

 

5. Restarted the application.

 

 

luizpolli@PCWIN11-LPOLLI:~$ sudo systemctl restart apache2
[sudo] password for luizpolli:

luizpolli@PCWIN11-LPOLLI:~$ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2024-12-10 17:32:43 CET; 3s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 53957 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 53961 (apache2)
      Tasks: 6 (limit: 18994)
     Memory: 13.8M
     CGroup: /system.slice/apache2.service
             ├─53961 /usr/sbin/apache2 -k start
             ├─53962 /usr/sbin/apache2 -k start
             ├─53963 /usr/sbin/apache2 -k start
             ├─53964 /usr/sbin/apache2 -k start
             ├─53965 /usr/sbin/apache2 -k start
             └─53966 /usr/sbin/apache2 -k start

Dec 10 17:32:43 PCWIN11-LPOLLI systemd[1]: Starting The Apache HTTP Server...
Dec 10 17:32:43 PCWIN11-LPOLLI systemd[1]: Started The Apache HTTP Server.
luizpolli@PCWIN11-LPOLLI:~$

 

 

 

6. Checking Splunk O11y SaaS apm page we cannot spans.

luizpolli_1-1733945234579.png


Any ideas on what is wrong or missing?

 

 

 

 

 

0 Karma

luizpolli
Loves-to-Learn

Nothing.

luizpolli_0-1734113664572.png

 

0 Karma

bishida
Splunk Employee
Splunk Employee

OK, perhaps 4318 was correct. Can you look at logs on the host where the OTel collector is running and share any errors you find? You might see exporting errors there or some clues as to why your telemetry isn't making it to the back end.

0 Karma

luizpolli
Loves-to-Learn

The logs that I found are /var/log/apache2/access.log and error.log. I don't know how to attach all logs here.

0 Karma

bishida
Splunk Employee
Splunk Employee

You may just want to copy/paste a small sample of anything interesting in those logs. Can you also check /var/log/syslog or /var/log/messages for potentially interesting errors coming directly from the OTel collector?

0 Karma

luizpolli
Loves-to-Learn

This is /var/log/syslog. It's a loop this log. Always the same

Dec 14 10:19:27 PCWIN11-LPOLLI otelcol[211214]: #011go.opentelemetry.io/collector/processor/batchprocessor@v0.113.0/batch_processor.go:535
Dec 14 10:19:27 PCWIN11-LPOLLI otelcol[211214]: go.opentelemetry.io/collector/processor/batchprocessor.(*shard[...]).sendItems
Dec 14 10:19:27 PCWIN11-LPOLLI otelcol[211214]: #011go.opentelemetry.io/collector/processor/batchprocessor@v0.113.0/batch_processor.go:261
Dec 14 10:19:27 PCWIN11-LPOLLI otelcol[211214]: go.opentelemetry.io/collector/processor/batchprocessor.(*shard[...]).startLoop
Dec 14 10:19:27 PCWIN11-LPOLLI otelcol[211214]: #011go.opentelemetry.io/collector/processor/batchprocessor@v0.113.0/batch_processor.go:221
Dec 14 10:19:27 PCWIN11-LPOLLI otelcol[211214]: 2024-12-14T10:19:27.551+0100#011warn#011batchprocessor@v0.113.0/batch_processor.go:263#011Sender failed#011{"kind": "processor", "name": "batch", "pipeline": "logs", "error": "sending queue is full"}
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: 2024-12-14T10:19:28.109+0100#011info#011internal/retry_sender.go:126#011Exporting failed. Will retry the request after interval.#011{"kind": "exporter", "data_type": "logs", "name": "splunk_hec", "error": "HTTP 404 \"Not Found\"", "interval": "44.55953462s"}
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: 2024-12-14T10:19:28.555+0100#011error#011internal/base_exporter.go:130#011Exporting failed. Rejecting data.#011{"kind": "exporter", "data_type": "logs", "name": "splunk_hec", "error": "sending queue is full", "rejected_items": 77}
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: go.opentelemetry.io/collector/exporter/exporterhelper/internal.(*BaseExporter).Send
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: #011go.opentelemetry.io/collector/exporter@v0.113.0/exporterhelper/internal/base_exporter.go:130
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: go.opentelemetry.io/collector/exporter/exporterhelper.NewLogsRequest.func1
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: #011go.opentelemetry.io/collector/exporter@v0.113.0/exporterhelper/logs.go:138
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: go.opentelemetry.io/collector/consumer.ConsumeLogsFunc.ConsumeLogs
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: #011go.opentelemetry.io/collector/consumer@v0.113.0/logs.go:26
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/splunkhecexporter.(*perScopeBatcher).ConsumeLogs
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: #011github.com/open-telemetry/opentelemetry-collector-contrib/exporter/splunkhecexporter@v0.113.0/batchperscope.go:50
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchperresourceattr.(*batchLogs).ConsumeLogs
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: #011github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchperresourceattr@v0.113.0/batchperresourceattr.go:172
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: go.opentelemetry.io/collector/internal/fanoutconsumer.(*logsConsumer).ConsumeLogs
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: #011go.opentelemetry.io/collector/internal/fanoutconsumer@v0.113.0/logs.go:73
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: go.opentelemetry.io/collector/processor/processorhelper.NewLogs.func1
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: #011go.opentelemetry.io/collector/processor@v0.113.0/processorhelper/logs.go:66
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: go.opentelemetry.io/collector/consumer.ConsumeLogsFunc.ConsumeLogs
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: #011go.opentelemetry.io/collector/consumer@v0.113.0/logs.go:26
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: go.opentelemetry.io/collector/processor/batchprocessor.(*batchLogs).export
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: #011go.opentelemetry.io/collector/processor/batchprocessor@v0.113.0/batch_processor.go:535
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: go.opentelemetry.io/collector/processor/batchprocessor.(*shard[...]).sendItems
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: #011go.opentelemetry.io/collector/processor/batchprocessor@v0.113.0/batch_processor.go:261
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: go.opentelemetry.io/collector/processor/batchprocessor.(*shard[...]).startLoop
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: #011go.opentelemetry.io/collector/processor/batchprocessor@v0.113.0/batch_processor.go:221
Dec 14 10:19:28 PCWIN11-LPOLLI otelcol[211214]: 2024-12-14T10:19:28.555+0100#011warn#011batchprocessor@v0.113.0/batch_processor.go:263#011Sender failed#011{"kind": "processor", "name": "batch", "pipeline": "logs", "error": "sending queue is full"}
Dec 14 10:19:35 PCWIN11-LPOLLI systemd-resolved[121]: Clock change detected. Flushing caches.

 
This is /var/log/dmesg. Not so helpful.

[    0.537467] kernel: Adding 4194304k swap on /dev/sdb.  Priority:-2 extents:1 across:4194304k
[    1.252079] kernel: clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x25a399d04c4, max_idle_ns: 440795206293 ns
[    1.256080] kernel: clocksource: Switched to clocksource tsc
[    2.039875] kernel: IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    2.700859] kernel: hv_pci 1da5db4a-ecd2-4832-aa94-05f9e3555f64: PCI VMBus probing: Using version 0x10004
[    2.703245] kernel: hv_pci 1da5db4a-ecd2-4832-aa94-05f9e3555f64: PCI host bridge to bus ecd2:00
[    2.703785] kernel: pci_bus ecd2:00: root bus resource [mem 0xc00000000-0xe00001fff window]
[    2.704246] kernel: pci_bus ecd2:00: No busn resource found for root bus, will use [bus 00-ff]
[    2.705198] kernel: pci ecd2:00:00.0: [1af4:105a] type 00 class 0x088000
[    2.707331] kernel: pci ecd2:00:00.0: reg 0x10: [mem 0xe00000000-0xe00000fff 64bit]
[    2.709397] kernel: pci ecd2:00:00.0: reg 0x18: [mem 0xe00001000-0xe00001fff 64bit]
[    2.711072] kernel: pci ecd2:00:00.0: reg 0x20: [mem 0xc00000000-0xdffffffff 64bit]
[    2.714335] kernel: pci_bus ecd2:00: busn_res: [bus 00-ff] end is updated to 00
[    2.714818] kernel: pci ecd2:00:00.0: BAR 4: assigned [mem 0xc00000000-0xdffffffff 64bit]
[    2.716490] kernel: pci ecd2:00:00.0: BAR 0: assigned [mem 0xe00000000-0xe00000fff 64bit]
[    2.718167] kernel: pci ecd2:00:00.0: BAR 2: assigned [mem 0xe00001000-0xe00001fff 64bit]
[    2.727428] kernel: virtiofs virtio1: Cache len: 0x200000000 @ 0xc00000000
[    2.789025] kernel: memmap_init_zone_device initialised 2097152 pages in 20ms
[    2.800876] kernel: FS-Cache: Duplicate cookie detected
[    2.803571] kernel: FS-Cache: O-cookie c=00000005 [p=00000002 fl=222 nc=0 na=1]
[    2.804522] kernel: FS-Cache: O-cookie d=000000003e7c27de{9P.session} n=0000000049c81f03
[    2.805210] kernel: FS-Cache: O-key=[10] '34323934393337353730'
[    2.806200] kernel: FS-Cache: N-cookie c=00000006 [p=00000002 fl=2 nc=0 na=1]
[    2.806933] kernel: FS-Cache: N-cookie d=000000003e7c27de{9P.session} n=00000000ccf62711
[    2.807563] kernel: FS-Cache: N-key=[10] '34323934393337353730'
[    3.062342] kernel: scsi 0:0:0:2: Direct-Access     Msft     Virtual Disk     1.0  PQ: 0 ANSI: 5
[    3.115930] kernel: sd 0:0:0:2: Attached scsi generic sg2 type 0
[    3.216153] kernel: sd 0:0:0:2: [sdc] 2147483648 512-byte logical blocks: (1.10 TB/1.00 TiB)
[    3.260507] kernel: sd 0:0:0:2: [sdc] 4096-byte physical blocks
[    3.265571] kernel: sd 0:0:0:2: [sdc] Write Protect is off
[    3.273898] kernel: sd 0:0:0:2: [sdc] Mode Sense: 0f 00 00 00
[    3.275831] kernel: sd 0:0:0:2: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    3.284253] kernel: sd 0:0:0:2: [sdc] Attached SCSI disk
[    3.297655] kernel: EXT4-fs (sdc): mounted filesystem with ordered data mode. Opts: discard,errors=remount-ro,data=ordered. Quota mode: none.[    3.862735] kernel: misc dxg: dxgk: dxgkio_is_feature_enabled: Ioctl failed: -22
[    3.874190] kernel: misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    3.877247] kernel: misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    3.879783] kernel: misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    3.881239] kernel: misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2
[    4.763755] unknown: WSL (2) ERROR: WaitForBootProcess:3352: /sbin/init failed to start within 10000
[    4.763760] unknown: ms
[    4.781653] unknown: WSL (2): Creating login session for luizpolli


If you need something. Let me know.

0 Karma

bishida
Splunk Employee
Splunk Employee

The messages in your /var/log/syslog appear to be a separate issue. If you want to collect logs, you can either configure your "splunk_hec" exporter to use your own Splunk HEC endpoint and token or you can disable logs for now by removing "splunk_hec" from your logs pipeline (service->pipelines->logs->exporters [remove splunk_hec])

I'm wondering if you are getting APM data into O11y Cloud but perhaps aren't generating traffic that creates spans? Can you be sure to generate some test traffic in your app that will definitely create a span? Something that calls another app or API would be ideal.

You can also look for clues in the Metric Finder. Search there for the service.name you defined in your instrumentation and see if you're getting any metrics for that service.name. 

0 Karma

luizpolli
Loves-to-Learn

In metrics finder we can't see anything about the service.name.

luizpolli_0-1734274792487.png

As far as I know my PHP is using zero code instrumentation. I have generated a lot of traffic and nothing. I performed a purchase, items in a cart and etc. Nothing of these spans are being reflected into O11y Cloud.

I don't about splunk HEC. I'm just starting using Splunk O11y. I need to study more about the http event collector.

 

 

0 Karma

bishida
Splunk Employee
Splunk Employee

I noticed one other thing that we should try. Since you're running a local instance of the OTel collector, can you unset the env variable OTEL_EXPORTER_OTLP_TRACES_HEADERS? We only want to send the token that way when you're not using a local collector.

You already changed your OTEL_OTLP_EXPORTER_ENDPOINT back to http://localhost:4318, correct?

Do you have your SPLUNK_ACCESS_TOKEN value set in /etc/otel/collector/splunk-otel-collector.conf? That token should have INGEST and API capabilities.  Also check that the correct secret is used in that token since you said you rotated the last one.

0 Karma

luizpolli
Loves-to-Learn

Hi bishida,

Any other sugestion?

0 Karma

bishida
Splunk Employee
Splunk Employee

I suspect the OTel auto instrumentation for PHP is not very mature as of today. I experimented with it and ran in to similar challenges. When I manually instrumented PHP, it did work and I see traces that way. 

0 Karma

luizpolli
Loves-to-Learn

Can you share your instrumented code?

0 Karma

bishida
Splunk Employee
Splunk Employee

I pulled this from one of the public examples for manual instrumentation and it worked. I think the only line I modified was the "require" line. One more note, I used .htaccess to expose env variables.

require __DIR__ . '/vendor/autoload.php';

 

<?php

declare(strict_types=1);

namespace OpenTelemetry\Example;

require __DIR__ . '/vendor/autoload.php';

use OpenTelemetry\Contrib\Otlp\OtlpHttpTransportFactory;
use OpenTelemetry\Contrib\Otlp\SpanExporter;
use OpenTelemetry\SDK\Trace\SpanProcessor\SimpleSpanProcessor;
use OpenTelemetry\SDK\Trace\TracerProvider;

$transport = (new OtlpHttpTransportFactory())->create('http://localhost:4318/v1/traces', 'application/x-protobuf');
$exporter = new SpanExporter($transport);

echo 'Starting OTLP example';

$tracerProvider =  new TracerProvider(
    new SimpleSpanProcessor(
        $exporter
    )
);
$tracer = $tracerProvider->getTracer('io.opentelemetry.contrib.php');

$root = $span = $tracer->spanBuilder('root')->startSpan();
$scope = $span->activate();

for ($i = 0; $i < 3; $i++) {
    // start a span, register some events
    $span = $tracer->spanBuilder('loop-' . $i)->startSpan();

    $span->setAttribute('remote_ip', '1.2.3.4')
        ->setAttribute('country', 'USA');

    $span->addEvent('found_login' . $i, [
        'id' => $i,
        'username' => 'otuser' . $i,
    ]);
    $span->addEvent('generated_session', [
        'id' => md5((string) microtime(true)),
    ]);

    $span->end();
}
$root->end();
$scope->detach();
echo PHP_EOL . 'OTLP example complete!  ';

echo PHP_EOL;
$tracerProvider->shutdown();
?>

 

bishida_0-1734640700777.png

bishida_1-1734642537097.png

 

0 Karma

luizpolli
Loves-to-Learn

Thanks for the code. It seems to work with that manually. I need to report Cisco that the zero-code instrumentation is not working as expected. I don't have privileges to open a case for that.

0 Karma

luizpolli
Loves-to-Learn

Changed everything as mentioned before, but no data collected into O11y Cloud.

0 Karma

luizpolli
Loves-to-Learn

The env variable OTEL_EXPORTER_OTLP_TRACES_HEADERS has not been created.

Regarding the OTEL_OTLP_EXPORTER_ENDPOINT it was set tot http://localhost:4317. Now I chnaged to 4318.

Regarding SPLUNK_ACCESS_TOKEN, I have not changed this value to the new one. Changed now.

I will restart the application and generates traffic again. Let you know.

0 Karma

luizpolli
Loves-to-Learn

Done. Follow the outputs.

luizpolli@PCWIN11-LPOLLI:~$ cat /etc/php/8.1/apache2/php.ini|grep OTEL
OTEL_RESOURCE_ATTRIBUTES="deployment.environment=prod,service.version=1.0"
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
OTEL_SERVICE_NAME=shopping
OTEL_PHP_AUTOLOAD_ENABLED=true


luizpolli@PCWIN11-LPOLLI:~$ env|grep OTEL
OTEL_RESOURCE_ATTRIBUTES=deployment.environment=prod,service.version=1.0
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
OTEL_SERVICE_NAME=shopping
OTEL_PHP_AUTOLOAD_ENABLED=true


luizpolli@PCWIN11-LPOLLI:~$ sudo systemctl restart apache2


luizpolli@PCWIN11-LPOLLI:~$ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2024-12-13 19:02:36 CET; 5s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 211814 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 211818 (apache2)
      Tasks: 7 (limit: 18994)
     Memory: 14.7M
     CGroup: /system.slice/apache2.service
             ├─211818 /usr/sbin/apache2 -k start
             ├─211819 /usr/sbin/apache2 -k start
             ├─211820 /usr/sbin/apache2 -k start
             ├─211821 /usr/sbin/apache2 -k start
             ├─211822 /usr/sbin/apache2 -k start
             ├─211823 /usr/sbin/apache2 -k start
             └─211824 /usr/sbin/apache2 -k start

Dec 13 19:02:36 PCWIN11-LPOLLI systemd[1]: Starting The Apache HTTP Server...
Dec 13 19:02:36 PCWIN11-LPOLLI systemd[1]: Started The Apache HTTP Server.
luizpolli@PCWIN11-LPOLLI:~$

 

0 Karma

bishida
Splunk Employee
Splunk Employee

Your token is exposed in your post. Please be sure to replace that token ASAP.

As for troubleshooting, I noticed you have 2 different values for OTEL_EXPORTER_OTLP_ENDPOINT. Is your goal to point your telemetry to a locally running instance of the OTel collector or do you want to bypass a collector and send directly to the Observability Cloud backend? 

0 Karma

luizpolli
Loves-to-Learn

Hi bishida,

The token has been rotated.

As a matter fact i tried to setup directly, but it was configured with otel collector before with the same result on env variables. Image below.

luizpolli_0-1734108204839.png

The idea is to configure locally running on an otel collector instance.

As mentioned before, even locally at otel collector or directly to o11y cloud is not working.

0 Karma

bishida
Splunk Employee
Splunk Employee

Can we try using the grpc endpoint (http://localhost:4317) instead of the http endpoint (http://localhost:4318)? It's possible that PHP uses grpc by default. 

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...