This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add permission and new API in log-manager (#5046)
Add permission check in log-manage Add log-manager API to retrieve log
- Loading branch information
1 parent
1e9580e
commit 2ccdc1b
Showing
17 changed files
with
508 additions
and
260 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright (c) Microsoft Corporation | ||
# All rights reserved. | ||
# | ||
# MIT License | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and | ||
# to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING | ||
# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
FROM alpine:3.10 | ||
|
||
# install dev tools | ||
RUN apk update && apk add --no-cache tini bash findutils | ||
COPY src/cleaner/ /usr/bin/cleaner/ | ||
ENTRYPOINT ["/sbin/tini","--","/usr/bin/cleaner/entrypoint.sh"] | ||
|
55 changes: 0 additions & 55 deletions
55
src/log-manager/build/log-manager-logrotate.k8s.dockerfile
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,43 @@ | ||
## Log-manager section parser | ||
|
||
- [Default Configuration](#D_Config) | ||
- [How to Configure](#HT_Config) | ||
- [Generated Configuration](#G_Config) | ||
- [Data Table](#T_config) | ||
- [Default configuration](#default-configuration) | ||
- [How to configure cluster section in service-configuration.yaml](#how-to-configure-cluster-section-in-service-configurationyaml) | ||
- [Generated Configuration](#generated-configuration) | ||
- [Table](#table) | ||
|
||
#### Default configuration <a name="D_Config"></a> | ||
#### Default configuration | ||
|
||
[log-manager default configuration](log-manager.yaml) | ||
|
||
#### How to configure cluster section in service-configuration.yaml <a name="HT_Config"></a> | ||
#### How to configure cluster section in service-configuration.yaml | ||
|
||
All configurations in this section is optional. If you want to customized these value, you can configure it in service-configuration.yaml. | ||
|
||
For example, if you want to use different port than the default 9103, add following to your service-configuration.yaml as following: | ||
```yaml | ||
log-manager: | ||
port: new-value | ||
port: new-value | ||
``` | ||
#### Generated Configuration <a name="G_Config"></a> | ||
#### Generated Configuration | ||
Generated configuration means the object model after parsing. The parsed data will be presented by a yaml format. | ||
```yaml | ||
log-manager: | ||
port: 9103 | ||
port: 9103 | ||
admin_name: admin | ||
admin_password: admin | ||
jwt_secret: "jwt_secret" | ||
token_expired_second: 120 | ||
``` | ||
#### Table <a name="T_Config"></a> | ||
<table> | ||
<tr> | ||
<td>Data in Configuration File</td> | ||
<td>Data in Cluster Object Model</td> | ||
<td>Data in Jinja2 Template</td> | ||
<td>Data type</td> | ||
</tr> | ||
<tr> | ||
<td>log-manager.port</td> | ||
<td>com["log-manager"]["port"]</td> | ||
<td>cluster_cfg["log-manager"]["port"]</td> | ||
<td>Int</td> | ||
</tr> | ||
</table> | ||
#### Table | ||
| Data in Configuration File | Data in Cluster Object Model | Data in Jinja2 Template | Data type | | ||
|-----------------------------------|---------------------------------------------|----------------------------------------------------|-----------| | ||
| log-manager.port | com["log-manager"]["port"] | cluster_cfg["log-manager"]["port"] | Int | | ||
| log-manager.admin_name | com["log-manager"]["admin_name"] | cluster_cfg["log-manager"]["admin_name"] | String | | ||
| log-manager.admin_password | com["log-manager"]["admin_password"] | cluster_cfg["log-manager"]["admin_password"] | String | | ||
| log-manager.jwt_secret | com["log-manager"]["jwt_secret"] | cluster_cfg["log-manager"]["jwt_secret"] | String | | ||
| log-manager.token_expired_second | com["log-manager"]["token_expired_second"] | cluster_cfg["log-manager"]["token_expired_second"] | Int | |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) Microsoft Corporation | ||
# All rights reserved. | ||
# | ||
# MIT License | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and | ||
# to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING | ||
# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
set -o errexit | ||
set -o pipefail | ||
|
||
log_exist_time=30 # 30 day | ||
if [ -n "${LOG_EXIST_TIME}" ]; then | ||
log_exist_time=${LOG_EXIST_TIME} | ||
fi | ||
|
||
cat > /etc/periodic/daily/remove_logs << EOF | ||
#!/bin/bash | ||
/usr/bin/pgrep -f ^find 2>&1 > /dev/null || find /usr/local/pai/logs/* -mtime +${log_exist_time} -type f -exec rm -fv {} \; | ||
EOF | ||
|
||
cat > /etc/periodic/weekly/remove_log_dir << EOF | ||
#!/bin/bash | ||
"/usr/bin/pgrep -f ^find 2>&1 > /dev/null || find /usr/local/pai/logs/* -mtime +${log_exist_time} -type d -empty -exec rmdir -v {} \;" | ||
EOF | ||
|
||
chmod a+x /etc/periodic/daily/remove_logs /etc/periodic/weekly/remove_log_dir | ||
|
||
echo "cron job added" | ||
|
||
crond -f -l 0 | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.