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

Add IIS logging #515

Merged
merged 32 commits into from
Apr 14, 2022
Merged

Add IIS logging #515

merged 32 commits into from
Apr 14, 2022

Conversation

Mrod1598
Copy link

@Mrod1598 Mrod1598 commented Apr 5, 2022

Add access logging for IIS based off of the W3C format.

Example log

image

@Mrod1598 Mrod1598 added kokoro:force-run Forces kokoro to run integration tests on a CL and removed kokoro:force-run Forces kokoro to run integration tests on a CL labels Apr 5, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 5, 2022
@Mrod1598 Mrod1598 added the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 5, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 5, 2022
@Mrod1598 Mrod1598 added the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 5, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 5, 2022
@Mrod1598 Mrod1598 added the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 6, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 6, 2022
@Mrod1598 Mrod1598 added the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 6, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 6, 2022
@jefferbrecht jefferbrecht self-requested a review April 11, 2022 17:33
apps/iis.go Outdated Show resolved Hide resolved
apps/iis.go Outdated Show resolved Hide resolved
apps/iis.go Outdated Show resolved Hide resolved
docs/iis.md Outdated Show resolved Hide resolved
docs/iis.md Outdated Show resolved Hide resolved
@Mrod1598 Mrod1598 added the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 13, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 13, 2022
@Mrod1598
Copy link
Author

      "userAgent": "Mozilla/5.0+(Windows+NT;+Windows+NT+10.0;+en-US)+WindowsPowerShell/5.1.17763.2268",

Is this information available somewhere in the logs for kokoro? It still seems to be failing and not showing whether or not any logs were detected at all.

@jefferbrecht
Copy link
Member

jefferbrecht commented Apr 13, 2022

Is this information available somewhere in the logs for kokoro? It still seems to be failing and not showing whether or not any logs were detected at all.

Sort of. main_log.txt at least shows the query it's using to detect logs:

2022/04/13 08:49:21 logName=~"projects/stackdriver-test-143416/logs/iis_access" AND resource.labels.instance_id="1562314732415439244" AND timestamp > "2022-04-13T07:49:21-07:00" AND httpRequest.serverIp=~"::1:80" AND httpRequest.remoteIp=~"::1" AND httpRequest.requestUrl=~"/forbidden\\?something=something" AND httpRequest.requestMethod=~"GET" AND httpRequest.userAgent=~"Mozilla\\/5\\.0\\+\\(Windows\\+NT;\\+Windows\\+NT\\+\\d+\\.\\d+;\\+en\\-US\\)\\+WindowsPowerShell\\/\\d+\\.\\d+\\.\\d+\\.\\d+"
2022/04/13 08:49:21 Query returned found=false, err=<nil>, attempt=1

build_and_test.txt also provides a link for Logs Explorer which you can use to check the actual ingested logs:

=== CONT  TestThirdPartyApps/windows-2019/iis
    third_party_apps_test.go:577: Instance Log: https://console.cloud.google.com/logs/viewer?resource=gce_instance%2Finstance_id%2F1562314732415439244&project=stackdriver-test-143416

I'm skeptical of all of the backslashes being double-escaped -- Cloud Logging queries accept regex strings as-is and let the underlying regex engine handle unescaping, so those queries are looking for literal backslashes which wasn't the intention. metadata.yaml looks fine to me.

I think it's this. The %q is inserting escape sequences where we don't want them. Can you try changing that to:

parts = append(parts, fmt.Sprintf(`%s=~"%s"`, field.Name, field.ValueRegex))

(this change might affect previously-passing tests so there's a chance we'll have to update non-IIS metadata.yaml too -- we'll see what happens with the next Kokoro run after that change)

@Mrod1598
Copy link
Author

Mrod1598 commented Apr 13, 2022

    third_party_apps_test.go:577: Instance Log: https://console.cloud.google.com/logs/viewer?resource=gce_instance%2Finstance_id%2F1562314732415439244&project=stackdriver-test-143416

I don't seem to access to that. Any chance we can get access?

@Mrod1598 Mrod1598 added the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 13, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 13, 2022
@jefferbrecht
Copy link
Member

jefferbrecht commented Apr 13, 2022

I don't think we grant access to that project outside of Google.

An alternative would be to run the integration test manually on a GCP project that you do have access to. This describes how to run it (you'll have to pass your GCP project in PROJECT). Be aware that you'll also have to pass AGENT_PACKAGES_IN_GCS as described here or else it'll run against the last released Ops Agent without any changes from your branch.

(but if there are any logs you'd like me to fetch for you from a stackdriver-test-143416 test run I'd be happy to do that)

@Mrod1598 Mrod1598 added the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 14, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 14, 2022
@Mrod1598 Mrod1598 added the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 14, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 14, 2022
@Mrod1598 Mrod1598 marked this pull request as ready for review April 14, 2022 11:37
@Mrod1598 Mrod1598 requested a review from jefferbrecht April 14, 2022 13:53
@jefferbrecht
Copy link
Member

jefferbrecht commented Apr 14, 2022

Looks great overall, glad the tests are passing now. Just a few minor threads still open. Mainly the Lua code needs to be updated to delete those three fields, the rest are nits.

@Mrod1598 Mrod1598 added the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 14, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 14, 2022
docs/iis.md Outdated Show resolved Hide resolved
Copy link
Member

@jefferbrecht jefferbrecht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo the last small change in the doc 👍

@Mrod1598 Mrod1598 added the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 14, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Apr 14, 2022
@jefferbrecht jefferbrecht merged commit ab48012 into GoogleCloudPlatform:master Apr 14, 2022
@Mrod1598 Mrod1598 deleted the iis-logging branch April 14, 2022 18:29
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

Successfully merging this pull request may close these issues.

3 participants