Closed oskrabanek closed 5 months ago
Local syslog are streamed to a socket and is not just writing to a folder, we don't have docs for Docker but for AKS we offer some guidance: https://learn.microsoft.com/en-us/azure/api-management/how-to-configure-local-metrics-logs#using-local-syslog-logs-on-azure-kubernetes-service-aks
Report
As I want to store the logs locally, I would like to enable LocalSyslog. According to the documentation this snippet should work.
But according to the log below the local path is tried to be resolved using DnsResolver, which fails and causes the logs not to be saved.
I'm testing it locally in the docker to be able to debug it easier.
Expected Behavior
The logs are stored in the given location.
Actual Behavior
The logs target directory is empty
Steps to Reproduce the Problem
USER root
Create log directory
RUN mkdir -p /app/logs/
USER apimuser
docker run
--rm
-it-p 8889:8080
--name ApimTest-ApimTestLocal-e telemetry.logs.std='text'
-e telemetry.logs.local='localsyslog'-e telemetry.logs.local.localsyslog.endpoint='/app/logs'
-e telemetry.logs.local.localsyslog.facility='7'-e config.service.endpoint='*********************************'
-e config.service.auth='GatewayKey ****' ` [name-of-your-image:latest]version: 2.3.2.0 commit: 55015ec2cb8387c342ce66e48d82a5c0cbd14948 [Info] 2023-07-26T10:57:57.155 [GatewayCipherSuite], message: Default cipher suites are being used for gateway. [Warn] 2023-07-26T10:57:57.157 [DnsResultionFailed], message: /app/logs, exception: System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): Name does not resolve at System.Net.Dns.GetHostEntryOrAddressesCore(String hostName, Boolean justAddresses, AddressFamily addressFamily, ValueStopwatch stopwatch) at System.Net.Dns.<>c.b33_0(Object s, ValueStopwatch stopwatch)
at System.Net.Dns.<>c__DisplayClass39_0`1.b 0(Task , Object )
at System.Threading.Tasks.ContinuationResultTaskFromTask`1.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Microsoft.WindowsAzure.ApiManagement.Proxy.Runtime.DefaultDnsNameResolver.ResolveAsync(String name, CancellationToken cancellation) in D:\a\1\s\Proxy\Gateway.Pipeline.IO\Dns\DefaultDnsNameResolver.cs:line 26
at Gateway.Pipeline.IO.Dns.DnsMonitor.Resolve(String hostname) in D:\a\1\s\Proxy\Gateway.Pipeline.IO\Dns\DnsMonitor.cs:line 92, source: DnsMonitor