DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
What's in store for DevOps in 2023? Hear from the experts in our "DZone 2023 Preview: DevOps Edition" on Fri, Jan 27!
Save your seat
  1. DZone
  2. Data Engineering
  3. Data
  4. GDPR: Top 5 Logging Best Practices One Should Follow

GDPR: Top 5 Logging Best Practices One Should Follow

When logging data, be wary of exposing the Personally Identifiable Information (PII) of your users. Read on for best practices to remain GDPR compliant while logging.

Stefan Thies user avatar by
Stefan Thies
·
May. 07, 18 · Opinion
Like (6)
Save
Tweet
Share
11.44K Views

Join the DZone community and get the full member experience.

Join For Free

The rather broad definition of personal data in the GDPR requires paying special attention to log data. GDPR and personal data in web server logs is a popular topic in many GDPR fora. For example, IP addresses or cookies might be considered personal data. Consequently, such data must be stored only with the consent of customers for a limited time. It is highly recommended to anonymize personal data before you hand over the logs to any third-party to minimize risk. A good example is the anonymization of IP addresses before you send data to Google Analytics.

Note that cloud and SaaS providers can't take the full responsibility for data you send to them for storage or analytics. In the GDPR world, the service provider often has two roles. The provider typically acts as "Data Controller" for your personal data (name, address, e-mail, phone number, etc.). For your content, such as your logs, the role of "Data Processor" might be applicable, in which case you are the "Data Controller" and you are responsible for logs you send to the cloud service provider.

So what are the best practices that will help you win the GDPR fight?

1. Centralize Log Storage

Centralize your log storage. This lets you apply policies in one place. Centralizing logs reduces the complexity and risk of maintaining policies in multiple places. Most log management services support retention policies per data source. You should define a reasonable retention time for every log source.

2. Delete Local Logs From Your Servers (Periodically)

Duplicated data could create problems when enforcing policies. Therefore, you should make sure that logs stored in a central place are removed from local servers as soon as possible. Logrotate is a common tool used to delete logs periodically (weekly by default). A streams the logs to the centralized log storage in near-realtime.

3. Structure Your Logs

You can structure logs with parser rules in a log shipper configuration. Structured logs make it easier to mask or anonymize sensitive data as we point out in the next step. Wherever possible, applications should log directly in a structured format like JSON. Using a structured log format saves human time needed to create parser rules, as well as CPU cycles for processing .

4. Anonymize Sensitive Data Fields in Logs

Identify and anonymize sensitive data fields before data is shipped to remote storage. Multiple techniques could be applied like hashing, encryption or removal of sensitive data fields.

5. Encrypted Logs in Transit

Use only encrypted channels to transmit log data to a central storage. Logs are often shipped unencrypted with Syslog/UDP for performance reasons. That is bad practice. Do not do that. Configure your syslog servers for TLS connections. If you use Elastic Stack, secure Elasticsearch and check X-Pack alternatives.

What's Next?

Some of the above are general logging best practices one should follow. With the arrival of the GDPR, it becomes essential to follow them in order to protect your organization from potential legal issues. Furthermore, if you are storing European data on servers outside of the EU, you are effectively exporting PII (Personally Identifiable Information). European law does not allow the exportation of users' "personally identifiable information" unless companies can demonstrate they will protect European users' privacy and data. Thus, if you are shipping your logs to a log management service, using a logging service in the EU is another best practice to consider.

Data (computing) Personal data

Published at DZone with permission of Stefan Thies, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Key Considerations When Implementing Virtual Kubernetes Clusters
  • A Beginner's Guide to Back-End Development
  • Integration: Data, Security, Challenges, and Best Solutions
  • How Observability Is Redefining Developer Roles

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: