APM Agent logs shown on Discover but not on APM UI

Hello all, Currently i am using ELK APM for my java application running on tomcat, with centos 7 as a linux distrubution and its my fresh installation but while apm java agent transfer the logs to apm server -> elastricsearch , i can see all the apm-* on discover menu with its logs/mertrics but i cant see any services on the APM UI, as it shows service not available.

Kibana version: 7.13.3
Elasticsearch version: 7.13.3
APM Server version: 7.13.3
APM Agent Java and version: 1.27.0

A common cause for this issue is a missing index mapping. Can you verify the mapping for the service.name field with:

GET apm-*/_mapping/field/service.name

If this returns a text mapping:

    "mappings" : {
      "service.name" : {
        "full_name" : "service.name",
        "mapping" : {
          "name" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          }
        }
      }
    }

then that is your issue and you'll need to recreate them - deleting the existing ones and restarting APM Server with the default configuration will accomplish that.

Hi @gil, thanks for the quick response , yeah i got this:

when i run this get request to my service name , i got this issue

Could you please tell me how to delete the existing ones and recreate , as i am new to elk-Apm, Looking forward to hear form you.

Ok great, then you've confirmed the cause. To recover:

  1. Stop your APM Server(s) so they are not writing any new documents
  2. Delete your existing apm-* indices either with DELETE apm-* in dev console or via the stack management UI, which looks like this:
  3. Start APM Server and ensure template setup is enabled - it's on by default, so make sure you don't have setup.template.enabled: false in your APM Server config (usually apm-server.yml)
  4. Verify the correct index templates were installed. That's either GET _template/apm-* in dev console or again via stack mangement UI, you're looking for their presence under "legacy index templates" like this:
1 Like

i did all those steps which you have included above but still i can't get any service name in apm GUI ,



here is also yml file scrnshot:

but still i am facing this issue

Hi @jorsec

Can you elaborate a bit on this part please :

To be a bit more specific:

  • Just to be sure, are you using Elastic agent or Elastic APM Java agent ?.
  • how is the Java agent configured ? Can you provide it's configuration (with credentials removed) ?
  • is there any error/warning in the Java agent log output ?
  • can you [capture agent debug logs] ?(Troubleshooting | APM Java Agent Reference [1.x] | Elastic)
  • the Java agent does not send application logs by default, however metrics are sent when the java agent starts, do you have any document created in the metrics-* indices ? Once metrics are sent the service becomes visible in Kibana.

Also, it might be worth checking our troubleshooting documentation if you haven't already.

Hi @Sylvain_Juge thanks for the respose, currenlty i am using elastic apm java agent with this configuration in tomcat:

export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/opt/apmagent/elastic-apm-agent-1.27.0.jar"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.service_name=zan"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.application_packages=com.example.zan"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.server_url=http://hostname:8200"

when i start the tomcat server, it's get connected to apm server without throwing any errors on catalina.out

i have metrics-* indices created but i dont have any metrics-* while verifying it throught the discover tab:

Thanks ,

Disclamer: I'm not an expert about the index patterns used for APM.

With a recent stack deployment (7.15.2), the APM metrics do not seem to be readable in the metrics-* index pattern, can you try with the following ?
traces-apm*,logs-apm*,metrics-apm*,apm-*

Normally this index pattern should have been automatically created for you on deployment.

hi @Sylvain_Juge , as this indices are created by default , while i check the apm indices:


image

and those indices are also pointed to apm-*, but i cant figure it out why it is not showing any service name in apm GUI

Thanks,

Hi @Sylvain_Juge & @gil ,

Any updates from your side , what i need to do to solve this issue.

Thanks,

You said you can see the "logs" in Discover
What happens when you simply go to Discover
Index Pattern apm-*
KQL bar

service.name:*

Do you see entries?

what about this

service.name : * and processor.event : "transaction"

I also noticed that you had very few documents in apm-transaction-7.13.1-000001 so make sure your time range is set correctly to contain the events BTW services will not show up in the APM UI if they are not within the specified time range.

Hello @stephenb ,
when i used this index pattern apm-* and service.name:* and processor.event : "transaction" in KQL bar i can see all their respective results,

but when i go to apm interface i cant get any servicename and their respective results.

Regarding the documents again i have delete those old documents, and again restarted the server but even cant see any service name in apm interface.

The fact there are still all those .keyword field means to me you are still not setup correctly they should not be there.

Also when you say you see all them what are the service.name