Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use .match(/pattern/) when using record_modifier #67

Open
PikaByter opened this issue Sep 26, 2022 · 1 comment
Open

how to use .match(/pattern/) when using record_modifier #67

PikaByter opened this issue Sep 26, 2022 · 1 comment

Comments

@PikaByter
Copy link

I want to add an api field to record_modifier, but it doesn't seem to work when I search with Kibana, it reports:

This field is present in your Elasticsearch mapping but not in the 500 documents shown in the doc table. You may still be able to visualize or search on it.

config:

    <filter {{ .Values.sourceTag }}>
      @type record_modifier
      <record>
        api ${record['log'].match(/\/api\/.*? /)}
        level
      </record>
    </filter>

record['log'] examples(one per line):

2022/09/26 16:34:30 DBG abc/xyz.go:46 > Register Route - DELETE, /api/role/v2
2022/09/26 16:34:30 DBG cmdbase/parser.go:46 > Register Route - GET, /api/role/v2/sys_feat
2022/09/26 16:34:30 Serving gRPC-Gateway on http://0.0.0.0:8070
2022/09/26 16:34:30 INF gwserver/gateway_server.go:152 > Start rest server in 0.0.0.0:7847
2022/09/26 16:35:36 DBG middleware/api_entry.go:97 > <- GET /api/ping to_xyz=infra-abc 4d65822107fcfd52
2022/09/26 16:35:36 DBG middleware/perm.go:93 > perm check, userID: 0, partyID:  4d65822107fcfd52
2022/09/26 16:35:36 /app/paas_go/cofu/models/party/party.go:311 record not found
2022/09/26 16:35:36 WRN monitor/instrument.go:75 > record metrics failed, Err: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp: address $[MONITOR_GRPCSERVICEURL]: missing port in address" 4d65822107fcfd52
2022/09/26 16:35:53 DBG middleware/api_entry.go:97 > <- GET /api/ping to_xyz=infra-yao 78629a0f5f3f164f
2022/09/26 16:35:53 DBG middleware/perm.go:93 > perm check, userID: 0, partyID:

When I change the configuration to the following, it can get data what doesn't match what I need exactly

    <filter {{ .Values.sourceTag }}>
      @type record_modifier
      <record>
        api ${record['log'].split(' ')[7])}
        level
      </record>
    </filter>

how to edit the config?

@PikaByter
Copy link
Author

I also try this,but I can not get data either.

    <filter {{ .Values.sourceTag }}>
      @type record_modifier
      <record>
        api ${record['log'].match(/.*/)}
        level
      </record>
    </filter>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant