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

[DOC]: 插件-输入-文本日志 2.0.0文档陈旧,操作无法产生预期的输出 #1387

Closed
crclz opened this issue Mar 3, 2024 · 4 comments · Fixed by #1394
Closed
Labels
documentation Improvements or additions to documentation

Comments

@crclz
Copy link
Contributor

crclz commented Mar 3, 2024

文档中展示了这样的输出,其中包含了__tag__。

{
    "__tag__:__path__": "/home/test-log/json.log",
    "content": "{\"key1\": 123456, \"key2\": \"abcd\"}",
    "__time__": "1657354763"
}

而事实上,如果跟着文档一步一步进行配置,是看不到任何关于__tag__的相关信息的,用户(例如我)就会产生疑惑。

我的解决方案(探索了半天才发现):在flusher中添加 Tags: true,成功输出了相关tag信息。

flushers:
  - Type: flusher_stdout
    OnlyStdout: true
    Tags: true

输出:

2024-03-03 05:42:21 [LogGroup] topic , logstore , logcount 1, tags [Key:"__pack_id__" Value:"953821F37BD38120-2"  Key:"__path__" Value:"/app/logtest/a.log"  Key:"_image_name_" Value:"docker.io/library/nginx:latest"  Key:"_container_name_" Value:"nginx"  Key:"_pod_name_" Value:"nginx-755b956c7c-94qqc"  Key:"_namespace_" Value:"default"  Key:"k8s_label_app" Value:"nginx"  Key:"_pod_uid_" Value:"d49293cd-617a-4da2-88f9-b65efcb524b6"  Key:"_container_ip_" Value:"10.244.0.176"  Key:"__inode__" Value:"2364991"  Key:"__hostname__" Value:"iZ2zegcmam2cfsnvepwzbkZ"  Key:"_node_name_" Value:"iz2zegcmam2cfsnvepwzbkz"  Key:"_node_ip_" Value:"172.25.37.183" ]
2024-03-03 05:42:21 {"__file_offset__":"66","content":"hello123aaaaasd999","__time__":"1709444541"}

建议:
由于flusher_stdout常常会被用于测试,建议在新书入门类型的章节中,或者使用到flusher_stdout的章节中,都提醒用户“如果要显示tags,请为flusher_stdout添加Tags: true的配置”

@crclz crclz added the documentation Improvements or additions to documentation label Mar 3, 2024
@crclz
Copy link
Contributor Author

crclz commented Mar 3, 2024

另外,这个文档页面也容易引起疑惑,上面是SK,下面是AK,比较反直觉,幸好我看日志解决了。

建议:调换图中二者的顺序。

https://ilogtail.gitbook.io/ilogtail-docs/installation/start-with-k8s

image

@messixukejia
Copy link
Collaborator

很好的建议,是否方便提交个PR修正下?

@crclz
Copy link
Contributor Author

crclz commented Mar 3, 2024

@messixukejia 好的,我这周摸鱼的时候改一改。

crclz added a commit to crclz/ilogtail that referenced this issue Mar 9, 2024
@crclz
Copy link
Contributor Author

crclz commented Mar 9, 2024

@messixukejia 提交了一个PR:#1394

yyuuttaaoo pushed a commit that referenced this issue Mar 10, 2024
* docs: adjust the order of access_key_id and access_key

* docs: enhance __tags__ in flusher_stdout use cases, resolves #1387
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants