News for hackers. Stuff that matters.
Re:I usually run 'w' first when troubleshooting unknown mach... by EngineerBetter on Tuesday March 27, 2018 @02:47AM (#16685913)
Genuine question: how many HN readers log on to boxes with user accounts that belong to humans, where some state may have been mutated?

My experience of the last five years is so heavily weighted to (effectively) immutable infrastructure that checking to see who had been on a box hadn't event crossed my mind.

Re:I usually run 'w' first when troubleshooting unknown mach... by mrweasel on Tuesday March 27, 2018 @03:02AM (#16685981)
I do that daily. Most of the services we run consist of 1 - 8 application servers ( often closer to 2 than 8), so things like Docker doesn't make much sense. Even though we of cause try to automate as much as possible, using things like Ansible, we often log in to servers directly to verify changes. Database servers are normally manually managed, to some extend, so we'll always login directly.

When I'm on-call and get an alarm on a server, checking that colleagues aren't logged in is normally the first thing you do. If a service fails it's more often than not someone doing maintenance, and they just forgot to tell you, or disable monitoring. And as someone else pointed out, also check disk usage.

Hacker News can be a little blind to the fact that most software projects are rather small and modern servers are really powerful. It's actually pretty rare that someone manages enough infrastructure for a single service that logging isn't a viable option.

Re:I usually run 'w' first when troubleshooting unknown mach... by technion on Tuesday March 27, 2018 @04:26AM (#16686422)
Even the word "small" is quite relative. One of my clients is big enough that you've probably heard of them, and their website/app (which is the company's only thing) is one LAMP server. That was only last year upgraded from a Windows 2003 WAMP server on a desktop. I tell friends what I did there and they say "wow you must be really good at Puppet at scale" based on assumptions.
Re:I usually run 'w' first when troubleshooting unknown mach... by thunfischbrot on Tuesday March 27, 2018 @07:41AM (#16687346)
Most people have yet to discover what a tiny little machine can do if you spend some time addressing bottlenecks. I have fond memories of running websites on the cheapest VPSs I could find, and getting very respectable performance from them with little more than cutting down on resource-hungry services, going static html whenever possible and being vigilant about any resources loaded by the browser.

See also https://lowendbox.com/ and https://hackernoon.com/10-things-i-learned-making-the-fastes...

Re:I usually run 'w' first when troubleshooting unknown mach... by ryandrake on Tuesday March 27, 2018 @09:39AM (#16688187)
I run a couple of very small scale (mostly static content) web sites and E-mail serving and a few other services on a single "Cheapest VPS" and have never gotten interested in Puppet or Ansible or any of the other things mentioned in this thread. It just seems like adding abstraction and automation on top of things that are not worth abstracting or automating. To me, these things are Yet Another Software That Could Fail. When I need to change a configuration file, I ssh in, sudo vi /etc/blahblah.conf and get on with my life.
Re:I usually run 'w' first when troubleshooting unknown mach... by jethro_tell on Tuesday March 27, 2018 @04:51PM (#16692625)
I just use versioned Makefiles for my very simple personal projects with my artifacts and configs in git. Pull the repo to the box, and run the make file. I commit config file changes then pull and make as needed. Everything is simple, it's manual automation so there is nothing running, but it's repeatable.

I put the bootstrap into an OS package and my server images point to my personal repo so I can configure run and build time dependencies as needed. At the end of the day, I can get a new server, run update, install my package and walk away and everything should be running, but it takes almost no additional overhead over doing it all by hand the first time.

Re:I usually run 'w' first when troubleshooting unknown mach... by theonealtair on Tuesday March 27, 2018 @10:35AM (#16688789)
I also was never interested in Puppet, however I was only interested in Ansible, and only use it as sort of an automated check list when setting up my server, in case I need to rebuild the server, the tedious steps can be automated. But I've never used it for multiple server management.
Re:I usually run 'w' first when troubleshooting unknown mach... by kelnos on Tuesday March 27, 2018 @10:45AM (#16688902)
So what happens when the hard drive fails and you lose all the data and configuration on the box?
Re:I usually run 'w' first when troubleshooting unknown mach... by nickpsecurity on Tuesday March 27, 2018 @12:25PM (#16690057)
Avoiding the huge, fast-changing software for configuration management doesn't mean you can't have CM or high availability on cheap boxes. The OpenVMS approach (see Section VI) combined good filesystem, clustering, optional OS-level virtualization, and distributed lock manager to have clustered systems that ran for years without downtime. Record was 17.

http://h41379.www4.hpe.com/openvms/whitepapers/high_avail.ht...

Those few building blocks done in a highly-robust way on one of the stable, Linux platforms could probably achieve the same thing. Just RAID 0, a good filesystem, clustering itself, and backups would get far. I know there's Linux-oriented products out there but I don't know if their availability or failover time have caught up yet.

Re:I usually run 'w' first when troubleshooting unknown mach... by ryandrake on Tuesday March 27, 2018 @11:32AM (#16689471)
My VPS host fixes it and I restore from backup.
Re:I usually run 'w' first when troubleshooting unknown mach... by teddyh on Tuesday March 27, 2018 @01:04PM (#16690526)
That’s what RAID and daily backups are for.
Re:I usually run 'w' first when troubleshooting unknown mach... by telchar on Tuesday March 27, 2018 @02:07PM (#16691162)
Yep. I got to say to my boss recently "you know those 2-4 servers I requested? You can forgot about that now, I optimized some things and we have plenty of capacity now on the one machine we've been using." That's an easy conversation to have.
Re:I usually run 'w' first when troubleshooting unknown mach... by bauerd on Tuesday March 27, 2018 @03:59AM (#16686306)
I share your viewpoint and am currently thinking through a similiar small-scale deployment. How do you handle logging? For single boxes I'd just use logwatch and friends, but for aggregating log output (both system/application logs) from a small-ish Consul cluster I feel the options are complete overkill. I've had a look at ELK, time-series backed stuff (e.g. Prometheus), but all I really want is log aggregation with search capability and optionally Regexp-based alerting.

It seems to me Logstash provides what I want, but I sure as hell won't run 3 JVMs and a Redis instance to aggregate logs.

tl;dr How to handle log aggregation within a small-scale cluster without losing your sanity?

Re:I usually run 'w' first when troubleshooting unknown mach... by ibotty on Tuesday March 27, 2018 @04:42AM (#16686493)
Monitoring and logging are best separated. Prometheus is great even on a small scale. For log aggregation there is the relatively new oklog.

I have been running oklog for a customer successfully. You ought to deploy it like a regular (non-cloud-native) service though: When a server crashes, restore the oklog instance from backups, not spinning a new one.

Re:I usually run 'w' first when troubleshooting unknown mach... by hn_user2 on Tuesday March 27, 2018 @04:17AM (#16686378)
For small stuff I still like the simple syslog. It’s usually built in and supports aggregating to a single server.

In the past have created a server just with syslog. Adjust all your servers syslog configs to point to that one. Then log in and use grep.

Not fancy. But gets the job done with a single line config change in your syslog configs.

Re:I usually run 'w' first when troubleshooting unknown mach... by arca_vorago on Tuesday March 27, 2018 @10:25AM (#16688672)
Senior sysadmin here, and I agree this is one of the most common methods. I have also had great success tying in the ossec or pam module notifications into syslog messages that all go to the central syslog (nsyslog/rsyslog etc) server. The problem with the elk and similar stacks imho is lack of security and speed. Things this old school setup doesn't have a problem with. The problem is that too many managers don't like not having gui dashboards... which is why splunk et al have really taken off.

This re-enforces my idea that a purely terminal based business dashboard might be a cool product with a fairly large market. I've been eyeballing some of the go/ncurses work for this.

Re:I usually run 'w' first when troubleshooting unknown mach... by devonkim on Tuesday March 27, 2018 @11:13AM (#16689250)
rsyslog or syslog-ng were preferred these days for better security and performance I thought? Unless you’re using something like stunnel to wrap the syslog messages that is.
Re:I usually run 'w' first when troubleshooting unknown mach... by devonkim on Tuesday March 27, 2018 @11:10AM (#16689215)
If you’re not violently opposed to MongoDB Graylog is very popular. I haven’t heard bad things about it so far besides the MongoDB portion but log aggregation is one of those systems that may be ok with some hiccups from time to time as opposed to an actual primary business data store.
Re:I usually run 'w' first when troubleshooting unknown mach... by mrweasel on Tuesday March 27, 2018 @04:55AM (#16686553)
We're kinda big on Splunk, everything that remotely looks like log data get shipped of to Splunk.

I've worked with ELK before and I'm not a fan, the usability is very low compared to Splunk. It's much cheaper though. At a previous employer we switch from Splunk to ELK and the number of searches we did on a daily basis dropped to almost zero. Before that almost every support "ticket" would start with a Splunk search.

You could also try out https://www.humio.com. I only seen it deploy by one customer, but it looks nice.

Re:I usually run 'w' first when troubleshooting unknown mach... by jsmeaton on Tuesday March 27, 2018 @05:20AM (#16686658)
We use Sumologic and it’s really nice. Much better than ELK. I’ve only used splunk in a evaluation context a long time ago, so I’m not sure how they’d compare. Splunk is just so expensive.
Re:I usually run 'w' first when troubleshooting unknown mach... by kondor6c on Tuesday March 27, 2018 @10:31AM (#16688730)
I found Sumologic to lack features that ELK has such as packetbeats. But you still have to manage the Sumologic forwarding agent and keep under your ingest limit. Additionally my mind never exactly flowed with their query syntax. They refreshed the UI recently and I liked it (aside from compounding my overutlization of tabs haha), you now more easily/graphically select time series from the graph. I can see how it is nice to not have to worry about re-indexing and what type of device the underlying data rests on. I have not tried the ELK hosted solution so some of my criticisms could apply to it as well.
Re:I usually run 'w' first when troubleshooting unknown mach... by Carasso on Tuesday April 03, 2018 @05:19PM (#16749385)
We use Humio alongside Splunk and they have an office in SF. Nice people, price is nice too :)
Re:I usually run 'w' first when troubleshooting unknown mach... by AzMoo_ on Tuesday March 27, 2018 @04:46AM (#16686508)
I just have a server dedicated to syslog and have rsyslog running on everything else.
Re:I usually run 'w' first when troubleshooting unknown mach... by kaitnieks on Tuesday March 27, 2018 @04:16AM (#16686372)
For simple, non-critical stuff this is the simplest solution I've come up with - if you don't need real-time aggregated logs (i.e. you only want to archive them) and you have log rotation configured, you can simply use cron with "aws s3 sync" or rsync for the logs folder.
Re:I usually run 'w' first when troubleshooting unknown mach... by greenleafjacob on Tuesday March 27, 2018 @04:16AM (#16686375)
Check out papertrail.
Re:I usually run 'w' first when troubleshooting unknown mach... by Fradow on Tuesday March 27, 2018 @04:06AM (#16686336)
On my personal dedicated server, I don't have any kind of "modern" things, I do everything the old way, so I do log manually. It's a feature, it's a way for me to learn old-school sysadmin (and I have so little things on here anyway automation is not needed).

For my startup, I often run bash on Heroku because I do migrations manually (again, it's a feature, I'm too inexperienced to have automated migrations that work everytime, I prefer to be already on it if it breaks). Sometime when something breaks I'll also poke around the filesystem (which is a copy, so no fear to break anything).

Basically, I'd say the smaller your team, your uptime requirements and your traffic is, the less you need automation, and the more you are susceptible to login directly to a box (I combine all of that: team of 1, no uptime requirement, not enough traffic to even max the most basic server).

Re:I usually run 'w' first when troubleshooting unknown mach... by majewsky on Tuesday March 27, 2018 @05:07AM (#16686603)
Counterpoint: Even on my private VPS, I have all the configuration as code. It gives me peace of mind knowing that when a server comes crashing down for whatever reason, I can reinstall it and bring all services back online with not more than one hour of time invested. Time is precious.

(Also, when someone asks me "how do you configure X", I can just link them to the corresponding place in my system configuration repo on Github.)

Re:I usually run 'w' first when troubleshooting unknown mach... by zacmps on Tuesday March 27, 2018 @05:19AM (#16686654)
I'd be interested in seeing the config if it's public?
Re:I usually run 'w' first when troubleshooting unknown mach... by Crontab on Tuesday March 27, 2018 @05:39AM (#16686742)
Re:I usually run 'w' first when troubleshooting unknown mach... by majewsky on Tuesday March 27, 2018 @06:04AM (#16686854)
Exactly. The Readme is horribly outdated, but the basic remarks are still true.
Re:I usually run 'w' first when troubleshooting unknown mach... by eythian on Tuesday March 27, 2018 @06:41AM (#16687014)
I have a small handful of VPSes for personal stuff that, more and more, I'm moving away from manual configuration to using ansible.

The reasons for this are several, but the most pressing are that if one falls over I can spin it up again quickly somewhere else, and I can have a lot of commonality in the configurations between them, so they all have backups configured the same way, or setting up letsencrypt requires editing things in only one place.

It also means I don't have to dig through a bunch of config when I want to work out how stuff is set up three years later, I can just look in one version-controlled directory in a central location.

Re:I usually run 'w' first when troubleshooting unknown mach... by raverbashing on Tuesday March 27, 2018 @04:40AM (#16686483)
Not to mention that while configuration management "magic" has taken over (Puppet/Chef - or even something higher level) you still need to set up those and you still need to know where to look when things go wrong.
Re:I usually run 'w' first when troubleshooting unknown mach... by lsc on Tuesday March 27, 2018 @05:05AM (#16686590)
>My experience of the last five years is so heavily weighted to (effectively) immutable infrastructure that checking to see who had been on a box hadn't event crossed my mind.

In web scale production, you mostly have to worry about your fellow sysadmins troubleshooting the problem, and they mostly won't be too mad about you clearing state.

But not everything is web scale production. Productionizing an app is a lot of work. Yes, yes, "Cloud is reliable!" and that's kinda true if you write your application to deal with any failure at any time. the reality is that the hardware can and will sometimes go away without warning, and you can't call up your oncall and tell them to head to the datacenter to fix it. all that recovery is done at the application layer; you had better hope you managed to make the data redundant enough. The whole idea behind the "cloud" is to take most of the lower level sysadmin work and make developers do it; and that's a fine way to some things, but... not so fine when it comes to other things.

(This is the value proposition of a VPS system rather than a "cloud" instance. when the hardware a VPS is on goes down, some poor bastard's pager goes off, and they are expected to wake up, drag themselves to the datacenter and fix it. The gamble is "is being down for a few hours now and again, when you can reasonably expect to be brought back up in the same configuration cheaper than writing your software such that you can always start over on a new node?" The VPS is for the former, the "Cloud" for the latter.)

Add to that, well, a lot of businesses need to run proprietary software. I personally, well, let us just say that for the last three years, the systems I am dealing with at work involve FlexLM.

so corp and smaller sites are littered with one-off systems... systems where if they break, a pager goes off, and someone fixes the problem. Sometimes that works better than the "web scale" stuff... like I've yet to see a "web scale" posix-ish filesystem that meets the user expectations the way NFS does, and I've never seen a nfs server that didn't require someone on pager.

Re:I usually run 'w' first when troubleshooting unknown mach... by closeparen on Tuesday March 27, 2018 @02:54AM (#16685942)
Our containers are immutable, but the bare metal hosts they run on aren’t.
Re:I usually run 'w' first when troubleshooting unknown mach... by movedx on Tuesday March 27, 2018 @04:13AM (#16686360)
No, but the "bare metal hosts" should be configured through configuration management and all logs sent "off site". I've been in the same boat and never had to log into a bare metal box. K8s and Ansible will do that for ya.
Re:I usually run 'w' first when troubleshooting unknown mach... by freehunter on Tuesday March 27, 2018 @12:05PM (#16689818)
I work on those "off site" machines that collect your logs and I'm sitting on one as root right now.

Ansible doesn't get you everywhere.

Re:I usually run 'w' first when troubleshooting unknown mach... by movedx on Wednesday March 28, 2018 @12:57AM (#16695395)
Yikes! We use time series databases, so we simply export the data from them to analytical software or our local machines.

InfluxDB is a simple command to extract what I need and then work with it from there.

Re:I usually run 'w' first when troubleshooting unknown mach... by closeparen on Tuesday March 27, 2018 @12:10PM (#16689875)
Puppet deploys a variety of host-level agents like L7 routing, dynamic config updaters, the scheduler agent (of course), metrics, logging, and tracing collection. Usually they work, but it’s necessary more often than you’d think to find out why one has fallen over and fix it, and to run diagnostic tools to investigate performance anomalies.
Re:I usually run 'w' first when troubleshooting unknown mach... by avip on Tuesday March 27, 2018 @03:41AM (#16686220)
The age of immutable inf. did not completely free us from occasional hotfixing production issues, because immutable deployment takes time, and if it's downtime you're accountable (as sysadmin/devops/whatever).
Re:I usually run 'w' first when troubleshooting unknown mach... by Rowern on Tuesday March 27, 2018 @04:34AM (#16686454)
So I am not the only one to have a slow eployment because re-building AMI and re-provisioning everything takes quite some times.

I also had a difficult time to explain that a prod deploy of 30min (image creation, deploy with blue green) is normal for this kind of inf... Did you face the same thing?

Re:I usually run 'w' first when troubleshooting unknown mach... by scrollaway on Tuesday March 27, 2018 @10:38AM (#16688823)
Rebuilding AMIs is not a thing you should be doing every deployment. Sounds like you are on AWS so use proper containers on ECS or EBS. Docker itself caches pretty aggressively. Decompose your projects as well so that the independent parts build and deploy without rebuilding everything else in the project that hasn't changed.

At the end of the day, if you're on continuous deployment, a commit should be rebuilding only what it touches. We have 4 min long deployments + 1.5 min tests and I definitely don't think we're optimizing aggressively.

Re:I usually run 'w' first when troubleshooting unknown mach... by devonkim on Tuesday March 27, 2018 @11:37AM (#16689526)
Things get awkward when versioning standards require all application components to have the same version because several version numbers running around is cognitive overhead that engineers can’t afford in many situations. With more than about 10 components I’ve usually seen it turn into “deploy 10 services that have 10 changes, 9 of which have one commit that bump a version number up.”

Many places still keep producing very stateful software (sometimes even very much by choice) that is better off managed through Puppet / Chef rather than an immutable containerized approach. If your software needs to take an hour and a half to shutdown, for example, you have to get a bit creative with your deployment strategies.

Re:I usually run 'w' first when troubleshooting unknown mach... by gpmcadam on Tuesday March 27, 2018 @03:50AM (#16686262)
A stitch in time, saves `kill -9`
Re:I usually run 'w' first when troubleshooting unknown mach... by gowld on Tuesday March 27, 2018 @10:45AM (#16688901)
Sounds like you are cutting corners on redundancy. Saves $$$, but risky.
Re:I usually run 'w' first when troubleshooting unknown mach... by shirro on Wednesday March 28, 2018 @07:30AM (#16696888)
When you have a small number of systems, a small team (possibly one person) and a relatively simple configuration it can be hard to justify spending time and money on a lot of deployment and automation. It isn't that deploying systems as you suggest isn't a better way of doing things. It is just the benefits are far greater at scale. At the scale I typically work it would be over-engineering most of the time.
Re:I usually run 'w' first when troubleshooting unknown mach... by markwillis82 on Tuesday March 27, 2018 @03:45AM (#16686236)
We have an immutable hosting platform with ansible, but some clients are hosted on their own boxes so we still end up logging into their hosting to sort out their issues (normally they have more problems than we do).

But they aren't interested in investing in more infrastructure when a single LNMP server does the job.

Re:I usually run 'w' first when troubleshooting unknown mach... by subway on Tuesday March 27, 2018 @03:40AM (#16686217)
even on immutable hosts it isn't surprising to see somebody has ssh'd in for debugging purposes. they might be attaching a debugger, taking a core dump, or doing a number of other things that could cause a drastic perf hit while not actually mutating the host's state otherwise.
Re:I usually run 'w' first when troubleshooting unknown mach... by jameshart on Tuesday March 27, 2018 @07:59AM (#16687442)
Why take the risk of continuing to run a tainted host, though, if you can just tear it down and spin up a new, clean, untouched one?

I think there’s another level we need beyond treating servers as pets or cattle, which is treating servers as wild animals; after you’ve captured one and interacted with it, you’ve doomed it because now it has the scent of humans on it.

Re:I usually run 'w' first when troubleshooting unknown mach... by subway on Tuesday March 27, 2018 @09:53AM (#16688336)
Sure, but that does nothing to prevent the person who invoke the debugger from inadvertently triggering prod alerts, possibly encouraging more folks to ssh in to see what's going on.
Re:I usually run 'w' first when troubleshooting unknown mach... by gowld on Tuesday March 27, 2018 @10:46AM (#16688919)
Good hiring and training practices prevent people from invoking the debugger on live prod machines
Re:I usually run 'w' first when troubleshooting unknown mach... by subway on Tuesday March 27, 2018 @10:52AM (#16688978)
There are times when it has to happen. It certainly shouldn't be an every day occurrence, but even in the best environments, there are times when SHTF only under a production workload, and you need an understanding of why yesterday.
Re:I usually run 'w' first when troubleshooting unknown mach... by drinchev on Tuesday March 27, 2018 @03:03AM (#16685988)
Mostly `root` with ssh-keys for authentication. Some provisioning scripts ( ansible ) that run under root and pretty much that's it.

I haven't seen human users in passwd, since virtualisation kicked in couple of years back.

Re:I usually run 'w' first when troubleshooting unknown mach... by chillidoor on Tuesday March 27, 2018 @06:46AM (#16687030)
I do this daily, mainly because most of our infrastructure isn't immutable yet :(
Re:I usually run 'w' first when troubleshooting unknown mach... by cup-of-tea on Tuesday March 27, 2018 @03:29AM (#16686149)
I do. In science we share clusters/supercomputers.
Re:I usually run 'w' first when troubleshooting unknown mach... by sneak on Tuesday March 27, 2018 @03:38AM (#16686210)
You are at the right hand side of the curve. Professionals do it that way, yes. Many smaller or less-well-managed organizations have a lot more warts.