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 option for customizing rsyslog application log format #231

Merged
merged 1 commit into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions planb/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def cli(debug: bool):
@click.option('--hosted-zone', help='create SRV records in this Hosted Zone')
@click.option('--scalyr-region')
@click.option('--scalyr-key')
@click.option('--rsyslog-format')
@click.option('--artifact-name', help='Pierone artifact name to use (default: planb-cassandra-3.0)')
@click.option('--docker-image', help='Docker image to use (default: latest planb-cassandra-3.0)')
@click.option('--environment', '-e', multiple=True)
Expand All @@ -79,6 +80,7 @@ def create(regions: list,
hosted_zone: str,
scalyr_region: str,
scalyr_key: str,
rsyslog_format: str,
artifact_name: str,
docker_image: str,
environment: list,
Expand Down Expand Up @@ -151,6 +153,7 @@ def extend(from_region: str,
@click.option('--instance-type', type=str)
@click.option('--scalyr-region')
@click.option('--scalyr-key')
@click.option('--rsyslog-format')
@click.option('--environment', '-e', multiple=True)
@click.option('--sns-topic', help=sns_topic_help)
@click.option('--sns-email', help=sns_email_help)
Expand All @@ -164,6 +167,7 @@ def update(cluster_name: str,
instance_type: str,
scalyr_region: str,
scalyr_key: str,
rsyslog_format: str,
environment: list,
sns_topic: str,
sns_email: str):
Expand Down
3 changes: 3 additions & 0 deletions planb/create_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ def generate_taupage_user_data(options: dict) -> str:
if options['scalyr_region']:
data['scalyr_region'] = options['scalyr_region']

if options['rsyslog_format']:
data['rsyslog_application_log_format'] = options['rsyslog_format']

if options['environment']:
data['environment'].update(options['environment'])

Expand Down
4 changes: 4 additions & 0 deletions planb/update_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ def build_run_instances_params(
if scalyr_key:
user_data_changes['scalyr_account_key'] = scalyr_key

log_format = options.get('rsyslog_format')
if log_format:
user_data_changes['rsyslog_application_log_format'] = log_format

params['UserData'].update(user_data_changes)
return params

Expand Down
6 changes: 4 additions & 2 deletions tests/test_update_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def test_build_run_instances_params():
'key2': 'value2'
},
'scalyr_region': 'eu',
'scalyr_key': 'new-shiny-scalyr-key'
'scalyr_key': 'new-shiny-scalyr-key',
'rsyslog_format': 'log-format'
}
expected = {
'MinCount': 1,
Expand Down Expand Up @@ -87,7 +88,8 @@ def test_build_run_instances_params():
'key2': 'value2'
},
'scalyr_region': 'eu',
'scalyr_account_key': 'new-shiny-scalyr-key'
'scalyr_account_key': 'new-shiny-scalyr-key',
'rsyslog_application_log_format': 'log-format'
}
}
actual = build_run_instances_params(ec2, saved_instance, options)
Expand Down