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 remote syslog configuration #14513

Merged
merged 8 commits into from
Jul 10, 2023
Merged

Conversation

iavraham
Copy link
Contributor

@iavraham iavraham commented Apr 4, 2023

  • Add an ability to configure remote syslog servers
  • Add an initial configuration for remote syslog
  • Extend YANG module and add unit tests

Why I did it

Adding the following functionality to rsyslog feature:

  • Configure remote syslog servers: protocol, filter, severity level
  • Update global syslog configuration: severity level, message format

How I did it

added parameters to syslog server and global configuration.

How to verify it

create syslog server using CLI/adding to Redis-DB
verify server is added to file /etc/rsyslog.conf and server is functional.

Description for the changelog

extend rsyslog capabilities, added server and global configuration parameters.

Link to config_db schema for YANG module changes

https://github.com/iavraham/sonic-buildimage/blob/master/src/sonic-yang-models/yang-models/sonic-syslog.yang

@@ -17,7 +17,10 @@ if [[ ($NUM_ASIC -gt 1) ]]; then
else
udp_server_ip=$(ip -j -4 addr list lo scope host | jq -r -M '.[0].addr_info[0].local')
fi
hostname=$(hostname)
Copy link
Collaborator

@qiluo-msft qiluo-msft May 13, 2023

Choose a reason for hiding this comment

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

hostname

There is DEVICE_METADATA/hostname in ConfigDB. Could you check which one is better? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is better to take from linux than DEVICE_METADATA/hostname.
example: DB can be empty if not configured with CLI. hostname can also be dynamically assigned using DHCP.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If DEVICE_METADATA/hostname has value, it should be preferred.

Copy link
Contributor

Choose a reason for hiding this comment

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

The hostname can be dynamically assigned by DHCP, in that case, DB value may contain the wrong hostname.
Plus DEVICE_METADATA is a configuration and not a STATE, once data is placed to DEVICE_METADATA it will update the system hostname according to https://github.com/sonic-net/sonic-host-services/blob/bc08806b64002c506b8401eae5d9e1c760651e49/scripts/hostcfgd#L1568
So in my opinion it is better to take it from the hostname utility as the most appropriate one.

@iavraham iavraham force-pushed the rsyslog-merge branch 2 times, most recently from c3e5cbc to d2a0298 Compare May 17, 2023 15:11
@dgsudharsan
Copy link
Collaborator

@iavraham Can you please update configuration.md to reflect the new schema changes?

@fastiuk fastiuk closed this May 22, 2023
@fastiuk fastiuk reopened this May 22, 2023
@fastiuk fastiuk self-assigned this May 22, 2023
@fastiuk fastiuk force-pushed the rsyslog-merge branch 2 times, most recently from 0cb8f8f to 062545d Compare May 23, 2023 19:58
@fastiuk
Copy link
Contributor

fastiuk commented May 23, 2023

@iavraham Can you please update configuration.md to reflect the new schema changes?

done

@@ -136,17 +136,6 @@
}
}
},
"SYSLOG_SERVER_INVALID_IPADDR_TEST" : {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this test removed? Is it because syslog server can be a string and hence IP validation cannot be done?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes

{% set regex = conf.get('filter_regex') -%}

{% set fmodifier = '!' if filter == 'exclude' else '' %}
{% set device = 'mgmt' if vrf in ['mgmt', 'management'] else 'eth0' %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This assumes that syslog server is reachable only through mgmt network or eth0. What if the server is reachable through the data network or OOB mgmt port?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, yes. I missed the address as well. I will fix it.
Good catch!

Copy link
Contributor

Choose a reason for hiding this comment

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

Updated

@fastiuk fastiuk force-pushed the rsyslog-merge branch 2 times, most recently from f5ed003 to b6d90a3 Compare May 26, 2023 18:51
@fastiuk fastiuk closed this May 28, 2023
@fastiuk fastiuk reopened this May 28, 2023
@fastiuk
Copy link
Contributor

fastiuk commented May 30, 2023

/azp run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 14513 in repo sonic-net/sonic-buildimage

@qiluo-msft qiluo-msft requested a review from ganglyu June 29, 2023 18:32
qiluo-msft pushed a commit to sonic-net/sonic-mgmt that referenced this pull request Jun 29, 2023
### Description of PR

Summary:
Fixes test fail in sonic-net/sonic-buildimage#14513

### Approach
#### What is the motivation for this PR?
Align the test according to the new rsyslog server type. Originally only IPv4 and IPv6 addresses were supported. Now hostames are supported as well 

#### How did you do it?
Update the generic updater test to follow new schema

#### How did you verify/test it?
Run it on t1 setup
@fastiuk fastiuk closed this Jun 29, 2023
@fastiuk fastiuk reopened this Jun 29, 2023
@fastiuk fastiuk closed this Jun 30, 2023
@fastiuk fastiuk reopened this Jun 30, 2023
@fastiuk
Copy link
Contributor

fastiuk commented Jul 3, 2023

@qiluo-msft all comments addressed. Please take a look and if everything looks good to you, please merge that PR

Copy link
Contributor

@wen587 wen587 left a comment

Choose a reason for hiding this comment

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

LGTM

* Add an ability to configure remote syslog servers
* Add an initial configuration for remote syslog
* Extend YANG module and add unit tests

Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
@fastiuk
Copy link
Contributor

fastiuk commented Jul 4, 2023

@qiluo-msft updated according to the last comment. Could you please take a look?

@dgsudharsan
Copy link
Collaborator

@qiluo-msft Can you please review and signoff?

@qiluo-msft qiluo-msft merged commit 72021fd into sonic-net:master Jul 10, 2023
16 checks passed
qiluo-msft pushed a commit that referenced this pull request Aug 14, 2023
)

cherry-pick: #14513
depends: sonic-net/sonic-utilities#2939

* Add an ability to configure remote syslog servers
* Add an initial configuration for remote syslog
* Extend YANG module and add unit tests

#### Why I did it
Adding the following functionality to rsyslog feature:

* Configure remote syslog servers: protocol, filter, severity level
* Update global syslog configuration: severity level, message format

#### How I did it
added parameters to syslog server and global configuration.

#### How to verify it
create syslog server using CLI/adding to Redis-DB
verify server is added to file /etc/rsyslog.conf and server is functional.

#### Description for the changelog
extend rsyslog capabilities, added server and global configuration parameters.

#### Link to config_db schema for YANG module changes
[sonic-syslog.yang](https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/yang-models/sonic-syslog.yang)
sonic-otn pushed a commit to sonic-otn/sonic-buildimage that referenced this pull request Sep 20, 2023
* Add an ability to configure remote syslog servers
* Add an initial configuration for remote syslog
* Extend YANG module and add unit tests

#### Why I did it
Adding the following functionality to rsyslog feature:

- Configure remote syslog servers: protocol, filter, severity level
- Update global syslog configuration: severity level, message format

#### How I did it
added parameters to syslog server and global configuration.

#### How to verify it
create syslog server using CLI/adding to Redis-DB
verify server is added to file /etc/rsyslog.conf and server is functional.

#### Description for the changelog
extend rsyslog capabilities, added server and global configuration parameters.

#### Link to config_db schema for YANG module changes
https://github.com/iavraham/sonic-buildimage/blob/master/src/sonic-yang-models/yang-models/sonic-syslog.yang
mrkcmo pushed a commit to Azarack/sonic-mgmt that referenced this pull request Oct 3, 2023
…-net#8668)

### Description of PR

Summary:
Fixes test fail in sonic-net/sonic-buildimage#14513

### Approach
#### What is the motivation for this PR?
Align the test according to the new rsyslog server type. Originally only IPv4 and IPv6 addresses were supported. Now hostames are supported as well 

#### How did you do it?
Update the generic updater test to follow new schema

#### How did you verify/test it?
Run it on t1 setup
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Jan 25, 2024
…-net#8668)

### Description of PR

Summary:
Fixes test fail in sonic-net/sonic-buildimage#14513

### Approach
#### What is the motivation for this PR?
Align the test according to the new rsyslog server type. Originally only IPv4 and IPv6 addresses were supported. Now hostames are supported as well 

#### How did you do it?
Update the generic updater test to follow new schema

#### How did you verify/test it?
Run it on t1 setup
@qiluo-msft
Copy link
Collaborator

Hard coded eth0 is fixed in a future #17616

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.

5 participants