-
Notifications
You must be signed in to change notification settings - Fork 527
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
Adding geolocation attrs to app_logs #11699
Merged
carsonip
merged 12 commits into
elastic:main
from
LikeTheSalad:mobile-events-geolocation
Sep 26, 2023
Merged
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e3246d6
Adding conditional geolocation to mobile event logs
LikeTheSalad 37444ac
Updated apmpackage changelog.yml
LikeTheSalad b0ec59e
Using existing pipeline "client_geoip" for app_logs ingest
LikeTheSalad 5e7be13
Adding system test for mobile logs with geolocation
LikeTheSalad 3f58eee
Updating changelog.yml
LikeTheSalad 806f757
Update apmpackage/apm/changelog.yml
LikeTheSalad 62bbcfa
Moving mobile logs with geolocation tests over to otlp_test.go
LikeTheSalad aab52f3
Renaming test
LikeTheSalad 1cdac26
Merge remote-tracking branch 'origin/mobile-events-geolocation' into …
LikeTheSalad a7a3d9a
Reordering imports in ingest_test.go
LikeTheSalad 9de88e6
Add changelog
carsonip 8ac3136
Merge branch 'main' into mobile-events-geolocation
carsonip File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to remove the field on failure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why we should tbh, although it seems like the same is done in other places when using the
geoip
processor which made me think that there might be a reason for it, so I just left it to keep consistency with all other usages, but I'm ok to remove this part if it's not needed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion on this. Actually, it may be helpful to just use a predefined geo ip pipeline here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with using that predefined pipeline, however, doing so would append geo attrs to all logs, instead of only the ones with the attribute
event.category
set todevice
. I'm not sure is that could cause problems to the apm server.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LikeTheSalad you can execute the pipeline conditionally as well:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just discussed this with Silvia. We think that unless there's a specific reason, we'd prefer running the pipeline without the
if
check. Since we are already running client_geoip ingest pipeline for most of the other data streams, the fact that it is missing in this app_logs data stream appears to be only an oversight. Also, client.ip is only populated for swift / android otel agents ANDcapture_personal_data: true
, so it should be fine to run client_geoip whenever client.ip exists.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! That makes things simpler, cheers!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I finished creating the system test for this use case and I also applied the changes to use the existing
client_geoip
pipeline without conditions.I found out a couple of things while I was working on the test:
capture_personal_data
flag seems to be enabled by default (at least for the system tests), because when I was adding a new config insidesystemtest/apmservertest/config.go
, I printed some logs in here where we're reading the config and realized that theif
body was always getting executed no matter if I added the new config or not.agent.name
has to be eitherandroid/java
oriOS/swift
for theclient.ip
attr to be populated (as mentioned by @carsonip), and the second one was that the client.ip value received by the server during the tests was127.0.0.1
which the server doesn't know how to translate into a location (which makes sense), so I had to override the local IP during testing by setting a real one using theX-Forwarded-For
header so that the server could find a location from the client.ip attr.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.