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

Documentation for modify_fields #553

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

quentinmit
Copy link
Member

No description provided.

docs/modify_fields.md Show resolved Hide resolved
docs/modify_fields.md Outdated Show resolved Hide resolved
type: integer
httpRequest.requestUrl:
move_from: jsonPayload.path
httpRequest.referer:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
httpRequest.referer:
# Set the value of "httpRequest.referer" based on the
# "referer" field's value in the log entry.
# Do not set "httpRequest.referer" if the "referer" field's
# value is simply a place holder "-".
httpRequest.referer:

httpRequest.status:
move_from: jsonPayload.http_status
type: integer
httpRequest.requestUrl:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
httpRequest.requestUrl:
# Set the value of "httpRequest.requestUrl" based on the
# "path" field's value in the log entry.
# Also delete the original "path" field from the log entry.
httpRequest.requestUrl:

set_http_request:
type: modify_fields
fields:
httpRequest.status:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
httpRequest.status:
# Set the value of "httpRequest.status" based on the
# "http_status" field's value in the log entry.
# Convert the value into an integer if needed.
# Also delete the original "http_status" field from the log entry.
httpRequest.status:

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think these comments add anything to this config, especially with the sample input and output. The comment literally just repeats the YAML itself without providing any additional information.

docs/modify_fields.md Show resolved Hide resolved
docs/modify_fields.md Outdated Show resolved Hide resolved
docs/modify_fields.md Show resolved Hide resolved

If the source field did not exist, the output value will be set to
`<string>`. If the source field already exists (even if it contains an empty
string), the original value is unmodified.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
string), the original value is unmodified.
string), the original value is unmodified. This config option is not allowed if the source option is `static_value`.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is a net negative for readability; it should be obvious that default_value is meaningless if the config already specifies a static_value from the documentation that's already here. (Since a static value always exists.)

Copy link
Contributor

Choose a reason for hiding this comment

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

It is obvious to me, but I have been involved since the beginning of the design discussion, so I could be biased. We can defer it till Mary reads it, and hopefully it's a fresh view

Copy link

Choose a reason for hiding this comment

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

@quentinmit @qingling128 This is confusing. I'm just trying to create a new field with a static value without success. Is that possible with any of this 2 options, and which one? Thank you very much https://stackoverflow.com/questions/73295880/gcp-ops-agent-add-static-field

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @llermaly , the official documentation of this has been published at https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/configuration#logging-processor-modify-fields

In case of a bug, please report it at https://cloud.google.com/support-hub with the following details:

  • agent version
  • full agent log
  • full agent config
  • project and VM id
  • reproduction steps

Copy link
Member Author

Choose a reason for hiding this comment

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

@llermaly env isn't a valid field in a LogEntry; you should be able to use jsonPayload.env as a field with either static_value or default_value (the difference is if the input record has env set already, static_value will overwrite it but default_value will not).

docs/modify_fields.md Show resolved Hide resolved
docs/modify_fields.md Show resolved Hide resolved

If the source field did not exist, the output value will be set to
`<string>`. If the source field already exists (even if it contains an empty
string), the original value is unmodified.
Copy link
Contributor

Choose a reason for hiding this comment

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

It is obvious to me, but I have been involved since the beginning of the design discussion, so I could be biased. We can defer it till Mary reads it, and hopefully it's a fresh view

Copy link
Contributor

@qingling128 qingling128 left a comment

Choose a reason for hiding this comment

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

The content looks ok to me. Skipping LGTM because we don't plan to submit to this repo.

@quentinmit quentinmit force-pushed the quentin-logtransform-docs branch from 9370b09 to 10ed1ba Compare May 13, 2022 15:51
@qingling128
Copy link
Contributor

@ridwanmsharif
Copy link
Contributor

Lets revive this PR and try to get it merged soon

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.

4 participants