Multiple nodes of apis to scan

Kibana version:
7.2.0
APM Server version:
apm-server-7.2.0-x86_64.rpm
APM Agent language and version:
elastic-apm-agent-1.7.0.jar
Original install method (e.g. download page, yum, deb, from source, etc.) and version:
curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-7.2.0-x86_64.rpm
sudo rpm -vi apm-server-7.2.0-x86_64.rpm

https://search.maven.org/search?q=a:elastic-apm-agent
Fresh install or upgraded from other version?
Fresh install
Is there anything special in your setup?
NO
Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):

I have several applications that I want to monitor and each application also has different nodes. The problem is that the entire log goes to the main node and I want to see how each node behaves separately.

As we can see in the image, for example, there is authentication and authentication-api-node2 and as much as I use only node2 always the logs are directed to authentication. Each node internally in its properties is called as the original node, for example: authentication.

Then I will leave the fragment we use to start the services:

/usr/local/java/jdk1.8.0_171/bin/java '-XX:+UseG1GC -Xms512m -Xmx768m' -javaagent:/usr/local/elastic-apm-agent-1.7.0.jar \
    -Delastic.apm.service_name=authentication-api-node2 \
    -Delastic.apm.server_url=http://localhost:8200 \
    -Delastic.apm.secret_token= \
    -Delastic.apm.application_packages=com.digitalfactory.kerberos.authenticationapi \
    -jar /usr/local/project/api/authentication-api-node2/authentication-api-node2.jar \
    --spring.config.name=application,secrets \
    --spring.config.location=/usr/local/project/api/authentication-api-node2/application.properties,/usr/local/project/api/authentication-api-node2/secrets.properties \
    --spring.config.location=/usr/local/local_conf/master/jasypt.properties \
    --spring.cloud.bootstrap.location=/usr/local/local_conf/master/bootstrap-encryption.properties \
    --spring.config.location=/usr/local/local_conf/ssl.properties \
            > "/usr/local/logs/authentication-api-node2/authentication-api-node2-stdout.log" 2>&1 &

Internally for spring-boot each node of each api is called as its original node, example: all authentication-api nodes are called authentication, this is so that the eureka server can identify them and do the load balancing with ribbon.

Errors in browser console (if relevant):
No errors, just I want to know how to segregate logs according the node.

Could you clarify where the name authentication is configured. Is it configured via spring.application.name in application.properties?

Hi @felixbarny, yes, it is configured via spring.application.name in application.properties

Heh, that seems to be quite a funny edge case here. The value of the auto-detected service name (authentication-api-node2.jar -> authentication-api-node2) is the same as the explicitly set value (-Delastic.apm.service_name=authentication-api-node2). That's why the agent thinks the agent name has not been set explicitly which makes it look for a more appropriate value, which it found via the spring.application.name.

I'll change the logic which detects whether the value has been explicitly set. In the mean time, just set the explicit service name to a value which is different than authentication-api-node2.

Alternatively, use authentication as the service name for all your nodes and use the environment setting to differ between them.

2 Likes

Also if you want to see the transactions aggregated sometimes and the separate other times you can always send them to the same transaction name then filter by host.hostname or some other field to then just see the transactions from a single host ..

See this post for some additional options

1 Like