Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/400.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在BigQuery数据访问日志中记录自定义信息?_Java_Google App Engine_Logging_Google Bigquery - Fatal编程技术网

Java 如何在BigQuery数据访问日志中记录自定义信息?

Java 如何在BigQuery数据访问日志中记录自定义信息?,java,google-app-engine,logging,google-bigquery,Java,Google App Engine,Logging,Google Bigquery,我已经根据此设置了BigQuery数据访问日志的日志导出 在我的用例中,客户端没有直接访问BigQuery的权限。他们调用restapi,restapi从BigQuery获取数据并提供给客户端。我需要记录一些自定义信息,如请求数据的用户ID等,以及BigQuery数据访问日志。 我尝试使用userAgent字段,将应用程序名称设置为用户ID,但它没有显示在数据访问日志中 是否有办法将自定义信息记录在数据访问日志中?能否添加自定义数据作为对查询的注释 # hello, I'm a comment

我已经根据此设置了BigQuery数据访问日志的日志导出

在我的用例中,客户端没有直接访问BigQuery的权限。他们调用restapi,restapi从BigQuery获取数据并提供给客户端。我需要记录一些自定义信息,如请求数据的用户ID等,以及BigQuery数据访问日志。 我尝试使用
userAgent
字段,将应用程序名称设置为用户ID,但它没有显示在数据访问日志中


是否有办法将自定义信息记录在数据访问日志中?

能否添加自定义数据作为对查询的注释

 # hello, I'm a comment and I have meta-data
 SELECT * FROM `wherever`
请注意第一行,因为您可以使用它请求BigQuery在#legacySQL和#standardSQL之间进行选择

 #standardSQL
 # for metadata, respect the first line of the query to choose SQL variant
 # hello, I'm a comment and I have meta-data
 SELECT * FROM `wherever` 

您可以添加自定义数据作为查询的注释吗

 # hello, I'm a comment and I have meta-data
 SELECT * FROM `wherever`
请注意第一行,因为您可以使用它请求BigQuery在#legacySQL和#standardSQL之间进行选择

 #standardSQL
 # for metadata, respect the first line of the query to choose SQL variant
 # hello, I'm a comment and I have meta-data
 SELECT * FROM `wherever` 

下面是我看到的一些选项


1-使用作业的属性

您可以对其进行设置,使其包含在调用jobs API时可用的任何信息

jobReference.jobId  string  [Required] The ID of the job. The ID must contain   
                            only letters (a-z, A-Z), numbers (0-9),   
                            underscores (_), or dashes (-).   
                            The maximum length is 1,024 characters.  
我认为1024个字符足以编码您需要的任何元数据


2-另一个选项是使用作业的属性

configuration.labels object [Experimental] The labels associated with this job.
                            You can use these to organize and group your jobs.   
                            Label keys and values can be no longer than 63  
                            characters, can only contain lowercase letters, numeric
                            characters, underscores and dashes. International 
                            characters are allowed. Label values are optional. 
                            Label keys must start with a letter and each label in 
                            the list must have a different key.
有关
标签的更多信息,请访问。尽管它描述了数据集的标签,但它与作业使用的概念完全相同



最后,我建议避免调整用户的查询-特别是为了插入一些元数据,下面是我看到的一些选项


1-使用作业的属性

您可以对其进行设置,使其包含在调用jobs API时可用的任何信息

jobReference.jobId  string  [Required] The ID of the job. The ID must contain   
                            only letters (a-z, A-Z), numbers (0-9),   
                            underscores (_), or dashes (-).   
                            The maximum length is 1,024 characters.  
我认为1024个字符足以编码您需要的任何元数据


2-另一个选项是使用作业的属性

configuration.labels object [Experimental] The labels associated with this job.
                            You can use these to organize and group your jobs.   
                            Label keys and values can be no longer than 63  
                            characters, can only contain lowercase letters, numeric
                            characters, underscores and dashes. International 
                            characters are allowed. Label values are optional. 
                            Label keys must start with a letter and each label in 
                            the list must have a different key.
有关
标签的更多信息,请访问。尽管它描述了数据集的标签,但它与作业使用的概念完全相同



最后,我建议避免调整用户的查询-尤其是为了插入一些元数据

Thank you@Mikhail。如果我使用
jobReference.jobId
字段,那么我还必须确保每次查询时都提供一个唯一的ID,这是一个最好避免的额外复杂性。和
配置。标签
似乎没有记录在BigQuery数据访问日志中。@SudarshanMurthy-是的,关于ID在计费项目中必须是唯一的,您是对的。从我的实践来看——这根本不是问题:o)谢谢@FelipeHoffa——感谢你的投票。能得到你和/或任何BigQuery团队成员的支持真的很特别!你干得太棒了!非常感谢。谢谢你,米哈伊尔。如果我使用
jobReference.jobId
字段,那么我还必须确保每次查询时都提供一个唯一的ID,这是一个最好避免的额外复杂性。和
配置。标签
似乎没有记录在BigQuery数据访问日志中。@SudarshanMurthy-是的,关于ID在计费项目中必须是唯一的,您是对的。从我的实践来看——这根本不是问题:o)谢谢@FelipeHoffa——感谢你的投票。能得到你和/或任何BigQuery团队成员的支持真的很特别!你干得太棒了!非常感谢。谢谢@Felipe。谢谢@Felipe。